Блог пользователя awoo

Автор awoo, история, 7 недель назад, По-русски

Neapolis University Pafos

Привет, Codeforces!

Благодаря поддержке Neapolis University Pafos, продолжается серия образовательных раундов.

В 30.07.2024 17:35 (Московское время) состоится Educational Codeforces Round 168 (Rated for Div. 2).

Этот раунд будет рейтинговым для участников с рейтингом менее 2100. Соревнование будет проводиться по немного расширенным правилам ICPC. Штраф за каждую неверную посылку до посылки, являющейся полным решением, равен 10 минутам. После окончания раунда будет период времени длительностью в 12 часов, в течение которого вы можете попробовать взломать абсолютно любое решение (в том числе свое). Причем исходный код будет предоставлен не только для чтения, но и для копирования.

Вам будет предложено 6 или 7 задач на 2 часа. Мы надеемся, что вам они покажутся интересными.

Задачи вместе со мной придумывали и готовили Адилбек adedalic Далабаев, Иван BledDest Андросов и Максим Neon Мещеряков. Также большое спасибо Михаилу MikeMirzayanov Мирзаянову за системы Polygon и Codeforces.

Удачи в раунде! Успешных решений!

UPD: Разбор опубликован

  • Проголосовать: нравится
  • +184
  • Проголосовать: не нравится

»
7 недель назад, # |
Rev. 2   Проголосовать: нравится +19 Проголосовать: не нравится

as a cyan (specialist) participant I hope to reach blue (expert) after this contest

update: I failed T_T
will try again

»
7 недель назад, # |
  Проголосовать: нравится +1 Проголосовать: не нравится

hopefully specialist after this one, good luck everyone

»
7 недель назад, # |
  Проголосовать: нравится +5 Проголосовать: не нравится

good luck to everyone :)

»
7 недель назад, # |
  Проголосовать: нравится +11 Проголосовать: не нравится

Educational Rounds always make sure participants learn something new every time. Good Luck Everyone !!

  • »
    »
    7 недель назад, # ^ |
      Проголосовать: нравится +16 Проголосовать: не нравится

    What is so educational about them? They don't seem so different from normal div. 2 rounds.

    • »
      »
      »
      7 недель назад, # ^ |
        Проголосовать: нравится +15 Проголосовать: не нравится

      From my experience, educational rounds have more straightforward problems that use a single kind of well-known technique which is supposed to be learnt by the participants during the contest.

»
7 недель назад, # |
  Проголосовать: нравится +3 Проголосовать: не нравится

Hoping to cross the 1300 barrier after this contest. Wishing luck to everyone!

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

as a participant, I will participate

»
7 недель назад, # |
  Проголосовать: нравится +2 Проголосовать: не нравится

Good Luck everyone. May this contest give you a minimum of +100!!

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Hoping to reach blue in this contest, good luck to everyone!

»
7 недель назад, # |
  Проголосовать: нравится +13 Проголосовать: не нравится

potato

»
7 недель назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

I am close to green, So I hope today I may reach it again, and best of luck to each participant !

  • »
    »
    7 недель назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    Me too. (I only need 7 to reach green) Good luck to you, me, and everyone!

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Wait, no testers ?!

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Wait, no testers ?!

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Hopefully i end in blue after this contest : )

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

as specialist i hope to reach expert after this contest

»
7 недель назад, # |
  Проголосовать: нравится +4 Проголосовать: не нравится

I just hope the pending can be faster.Why pending is often slow?

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

I hope the submission queue is not so long like previous div3 contests, When you get to know after 15 mins about wrong answer.

»
7 недель назад, # |
  Проголосовать: нравится +1 Проголосовать: не нравится

Started to do CP recently, I am finding it hard to select the which technique should be used for each problem and finding it is a big task any ideas and tips to improve the learning and improving

  • »
    »
    7 недель назад, # ^ |
      Проголосовать: нравится +1 Проголосовать: не нравится

    I don't have much experience, but I can say that only practice helps. It can be useful to review the problems and solutions of past competitions (but at the level you feel you can understand at the moment). My mistake was that I analyzed the solutions of the more difficult problems, although I could not solve the easier ones on my own. So I recommend solving gradually, it is better to solve an easier problem yourself than to understand or remember the solution of a harder one

  • »
    »
    7 недель назад, # ^ |
      Проголосовать: нравится +1 Проголосовать: не нравится

    Also at your level I recommend to pay more attention to past div 3 and div 4 contests, usually problems there easier than div 2

    • »
      »
      »
      7 недель назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

      thanks for the insight I have been working on it and most of the times I do make the mistake of analysing past problems but some times I can get the most optimal intuition but unable to convert the logic to code

»
7 недель назад, # |
  Проголосовать: нравится +6 Проголосовать: не нравится

Hope to reach grey.

»
7 недель назад, # |
  Проголосовать: нравится +1 Проголосовать: не нравится

Hope to reach cyan today

»
7 недель назад, # |
  Проголосовать: нравится +7 Проголосовать: не нравится

Guys the waiting queue is really long(my last submission has already waited for 30 mins),will it be all right before the contest?

»
7 недель назад, # |
  Проголосовать: нравится +1 Проголосовать: не нравится

Let me go back to Expert,CodeForces!

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Hope to reach....... Realising NO HOPE LEFT

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Only 20 points :)

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

manifesting to reach blue today fingers crossed

»
7 недель назад, # |
  Проголосовать: нравится +7 Проголосовать: не нравится

My first unrated Div. 2

»
7 недель назад, # |
  Проголосовать: нравится +5 Проголосовать: не нравится

Really hoping to learn more. Always been told I couldnt do cp

»
7 недель назад, # |
Rev. 3   Проголосовать: нравится 0 Проголосовать: не нравится

the worst round ever. 4 update messages in 20 minutes.

»
7 недель назад, # |
  Проголосовать: нравится -46 Проголосовать: не нравится

What I'll miss is that in the first 20-30 minutes there were four updates to problem B's condition, but problem D is a nightmare. The problem writer has 0 creativity. It’s like I’m reading a study problem>. Worst round

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

speedforces :'(

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

ok so my code that used a Node class and new() TLEs but it runs in 50ms with n=200k on my system.

when i get rid of the Node class and use ints it runs slightly faster on my end but AC

whats the big deal with new() taking forever???

  • »
    »
    7 недель назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    Use global variables, they are faster. Preallocate memory, rather than allocating runtime memory for better performance.

    There are disadvantages also, you need to make sure, you are not allocating more than required, or you will get MLE.

»
7 недель назад, # |
  Проголосовать: нравится +2 Проголосовать: не нравится

12k did C? lol. cheatforces. These idiots are digging their own grave.

  • »
    »
    7 недель назад, # ^ |
    Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

    so true lmao

    more people solved C than B, despite B having a way easier algorithm

  • »
    »
    7 недель назад, # ^ |
    Rev. 3   Проголосовать: нравится -12 Проголосовать: не нравится

    Guess what, aryanc403 bhai has tried C-problem 4 times. He is quite experienced and knows most of the things in CP. If it takes him 4 tries then the problem must be little challenging. and yet 12k people solved it.

    Definitely C is leaked. xD .

  • »
    »
    7 недель назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    C was easy compared with other Div 2s.

    • »
      »
      »
      7 недель назад, # ^ |
      Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

      Exactly i was unable to solve B but did C in less than 10 minute, also got idea to solve D but was not able to write code :(

      • »
        »
        »
        »
        7 недель назад, # ^ |
          Проголосовать: нравится 0 Проголосовать: не нравится

        tbh if you figured out only condition where one region becomes 3 it was easiest to implement check out my submission for more details

        • »
          »
          »
          »
          »
          7 недель назад, # ^ |
            Проголосовать: нравится 0 Проголосовать: не нравится

          Actually the problem was I didn't read the constraint properly which was stating, initially there will be at most 1 region.

          • »
            »
            »
            »
            »
            »
            7 недель назад, # ^ |
              Проголосовать: нравится 0 Проголосовать: не нравится

            ohh I was getting notifications again n again so I carefully read the problem

  • »
    »
    7 недель назад, # ^ |
      Проголосовать: нравится -6 Проголосовать: не нравится

    c was literally valid parenthesis from leetcode. It is one of the foundational problems for stacks. I think 12k submission is not justified. But it should be higher than usual div2 c. I solved it using rust as I am learning it.

    • »
      »
      »
      7 недель назад, # ^ |
        Проголосовать: нравится +1 Проголосовать: не нравится

      C is not just valid parenthesis lol

      • »
        »
        »
        »
        7 недель назад, # ^ |
        Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

        I just built a valid parenthesis and summed it up and got accepted. What is so hard about it ? And the cheaters gonna get skipped anyway. So I don't think it doesn't matter.

        • »
          »
          »
          »
          »
          7 недель назад, # ^ |
            Проголосовать: нравится +13 Проголосовать: не нравится

          well, u just answered to urself. You didn't prove why it will be minimum cost, and just guessed.

          • »
            »
            »
            »
            »
            »
            7 недель назад, # ^ |
              Проголосовать: нравится 0 Проголосовать: не нравится

            I think we have to close the open bracket as soon as possible then only we can get minimum cost.

          • »
            »
            »
            »
            »
            »
            7 недель назад, # ^ |
              Проголосовать: нравится 0 Проголосовать: не нравится

            Bro can you prove why there exists only one solution.

    • »
      »
      »
      7 недель назад, # ^ |
      Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

      It wasn't valid parenthesis problem, this problem's solution had some objective (greedy) and constraints, which is totally diff.

      • »
        »
        »
        »
        7 недель назад, # ^ |
          Проголосовать: нравится -6 Проголосовать: не нравится

        Yes it was, you just need to observer when the cost is minimum and fill the blanks accordingly.

  • »
    »
    7 недель назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    agree, such cheater ruined codeforces

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

is this rated for GMs , LGMs, IMs??

»
7 недель назад, # |
  Проголосовать: нравится -17 Проголосовать: не нравится

WTF ????????????? HOW NEWBIES AND PUPILS WITH < 150 PROBLEMS SOLVED ARE SOLVING D ????

5000 ACCEPTED ON D IN A DIV2 ROUND IS JUST INSANE.

  • »
    »
    7 недель назад, # ^ |
      Проголосовать: нравится +6 Проголосовать: не нравится

    Because it is very easy and classical, however I won't deny the presence of cheaters.

  • »
    »
    7 недель назад, # ^ |
      Проголосовать: нравится +1 Проголосовать: не нравится

    its standard problem, cheaters are there tho

    • »
      »
      »
      7 недель назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

      can you tell me about that standard problem

      • »
        »
        »
        »
        7 недель назад, # ^ |
        Rev. 2   Проголосовать: нравится +1 Проголосовать: не нравится

        i mean say we are on node v with value a[v] and the smallest element from every subtree of v is mn, and then a bit of case handling, if (mn<= a[v]) we go on with mn as the minimum value for the subtree that includes v , else we return (a[v]) + (mn — a[v])/2 that is simply getting both the values to their centre point .

        The idea is that dfs is returning the minimum element in the subtree of the node.

        You can see this soln 273567246 and its standard cuz its the simplest of DFS

        • »
          »
          »
          »
          »
          7 недель назад, # ^ |
            Проголосовать: нравится 0 Проголосовать: не нравится

          Why do we take values to their center? And how does taking to centre ensure that these values of subtree nodes will always be >=0 in the future.

          • »
            »
            »
            »
            »
            »
            7 недель назад, # ^ |
            Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

            so look i need to set the entire tree up in such a way that the minimum value in the subtree of 1 is maximized , excluding the value of node 1. Why? cuz if the minimum value is increased that means i can perform the operation on node 1, more times before the minimum value in subtree reaches 0.

            For the "if" case, say i have a node with val 5, and it has 3 children with values 3,7,9 now i will simply return 3, why? cuz if i perform any operation on node with val 5, the val 3 will decrease thus decreasing the minimum.

            For the "else" case, say i have a node with val 2 and it has 2 children with values say 7 and 9, so the min value of the subtree currently is 2, but we can make it better , as the minimum value of the child is 7, if i perform the operation twice the values will become 4, 5,7 . so i took them to their centre value. And more operations are clearly of no use as the minimum value that is currently 4 will start decreasing.

            So the idea is MAXIMIZING the MINIMUM in every subtree, beginning from leaf nodes to root.

            • »
              »
              »
              »
              »
              »
              »
              7 недель назад, # ^ |
                Проголосовать: нравится 0 Проголосовать: не нравится

              For the second case you can maximize the root to 11. And the tree after the operations becomes 11,0,2 Can you explain this else case again?

              • »
                »
                »
                »
                »
                »
                »
                »
                7 недель назад, # ^ |
                  Проголосовать: нравится 0 Проголосовать: не нравится

                alright so in the second case, lets say x has value 2, and it has 2 children y and z with values with 7 and 9, and x is connected to node 1.

                so the tree is like 1->x->(y,z)

                so the DFS begins, for y it will return 7 and for z it will return 9. now for x the minimum value amongst it's subtrees,i.e. y and z, will be 7. But its own value is 2 which is lower than 7.

                For better understanding , lets suppose we dont do any operations and simply return the minimum then we return 2. and now we are at node 1 , and the minimum element in all its children's subtrees is 2, so that means i can just increase the value of node 1 twice before one of the elements in the tree gets 0.

                Now, suppose we did some operations on x, so minmum amongst it's child subtrees was 7 and it's value was 2, how many operations should i do, such that the minimum of the entire subtree is MAXIMIZED and not only the value of node x? i should do (7-2)/2 = 2 operations so value of x would become 4, value of y and z gets 5 and 7, so the minimum of the subtree gets 4 and i return it , this is the maximized minimum of the subtree. And now i can perform 4 operations on node 1 :).

                Let's say what if i did more oerations on x ? say 2 more operations , x's value becomes 6, y and z become 3 and 5, now the minimum of the ENTIRE subtree is 3 , so that means i can only do 3 operations on node 1, which is not the best possibility , Thats why i take values to the center

            • »
              »
              »
              »
              »
              »
              »
              4 недели назад, # ^ |
                Проголосовать: нравится 0 Проголосовать: не нравится

              Great explanation! i did it in the same way

  • »
    »
    7 недель назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    IT is a pretty straight forward Tree DP Question. And not everybody learns mostly off codeforces, I just do codeforces for the contests, but rarely for Practice Purposes (except if they appear on USACO Guide)

    But yeah, 5k on D is still quite a lot.

    • »
      »
      »
      7 недель назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

      if you don't mind what other resource are you using?

      • »
        »
        »
        »
        7 недель назад, # ^ |
          Проголосовать: нравится 0 Проголосовать: не нравится

        I personally just do mostly USACO Guide. Doing Bronze to Silver and knowing some techniques from Gold should be enough in my opinion. Also it is very important to do the actual codeforces contests, since it does also help with general problem solving instead of just solving problems tied to specific topics

  • »
    »
    7 недель назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    Tbh as a newbie i found D easier than other div2 rounds but sadly i was not able to write code

»
7 недель назад, # |
  Проголосовать: нравится +10 Проголосовать: не нравится

Does anyone else keep getting WA on test case 19 for problem D? Solving E and losing rating is tough :((

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

I tried problem E, Got the correct solution. Exceeded the time limit :(

»
7 недель назад, # |
  Проголосовать: нравится +10 Проголосовать: не нравится

Imagine looking for an overflow for 30+ mins while telling yourself the following code snippet "definitely isn't the cause, its bounded by $$$n \cdot max(a)$$$".

Code snippet
  • »
    »
    7 недель назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    Wait this causes an overflow? :0 Can you explain why?

    • »
      »
      »
      7 недель назад, # ^ |
      Rev. 2   Проголосовать: нравится +7 Проголосовать: не нравится

      Consider a line graph with the following values of $$$a_i$$$

      $$$1 \rightarrow 0 \rightarrow 0 \rightarrow 0 \rightarrow 0 \cdots$$$

      Then if our starting "cost" (i.e., how much we want to add to the root) is $$$1$$$, then the corresponding values of cost for each node becomes:

      $$$1 \rightarrow 1 \rightarrow 2 \rightarrow 4 \rightarrow 8 \cdots$$$

      So the value simply overflows for any such line graph of more than $$$32$$$ / $$$64$$$ nodes depending on whether you're using 32 or 64 bit ints.

      • »
        »
        »
        »
        7 недель назад, # ^ |
          Проголосовать: нравится 0 Проголосовать: не нравится

        Got it, thanks! So we just need a special check once the the value is greater than $$$10^9$$$

»
7 недель назад, # |
  Проголосовать: нравится +8 Проголосовать: не нравится

The contest was really easy, the first 4 problems felt like Div. 3, and problem D was very classical.

»
7 недель назад, # |
  Проголосовать: нравится -9 Проголосовать: не нравится

The B question is something! How are they able to make such tough problems! I bet even gpt cannot solve these problems

  • »
    »
    7 недель назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    It was not that hard. You just have to find the free cell that serves as the only bridge to 3 free cells. You can look at my post contest submission to figure it out. I misread the problem statement and I thought there could be more than 1 sets. I solved it in that way in contest.

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

couldn't solve D

I'm so retarded,

doing cf for year and still nowhere near blue

  • »
    »
    7 недель назад, # ^ |
      Проголосовать: нравится +21 Проголосовать: не нравится

    It's ok it took me more than a year for expert

  • »
    »
    7 недель назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    You are specialist so you are definitely not retarded. I looked at your profile and 70% of your solved problems are below 1400, so maybe practice harder problems.

»
7 недель назад, # |
  Проголосовать: нравится +4 Проголосовать: не нравится

how to solve F, I tried many dp approaches but it didn't work.

  • »
    »
    7 недель назад, # ^ |
      Проголосовать: нравится +42 Проголосовать: не нравится

    Note that tokens behave like fibonacci sequence, you have $$$f_1$$$ $$$f_2$$$ and can create some $$$f_i$$$ for $$$i>=3$$$ using $$$f_{i-1}$$$ and $$$f_{i-2}$$$ or to change $$$f_i$$$ for $$$f_{i-1}$$$ and $$$f_{i-2}$$$. You can also freely change $$$f_1$$$ to $$$f_2$$$ and vice versa. So $$$f_i$$$ means token on position $$$i$$$.

    First convert all tokens to $$$f_1$$$ and $$$f_2$$$, let the number of them be $$$s$$$. Note that, because you can change $$$f_1$$$ to $$$f_2$$$ and vice versa, all that matter is their sum ($$$s$$$). You want to use minimum number of tokens to represent $$$s$$$. One token means some $$$f_i$$$. If you have $$$1000$$$ $$$f_{10}$$$ tokens maximum $$$s$$$ you can get is $$$55000$$$.

    Now you do greedy, for every sum $$$s <= 55000$$$, you go through $$$f_{30}$$$ to $$$f_1$$$ and try to fit sum $$$s$$$ in minimum number of tokens (there is proof for fibonacci numbers that greedy is optimal).

    Now for some sum $$$s$$$ you have $$$min[s]$$$ which represent minimum number of tokens to represent it. We want such $$$s$$$ that $$$min[s] = m$$$.

    Lastly we need to calculate in how many ways can we get sum $$$s$$$ using $$$n$$$ tokens on first $$$x$$$ $$$f$$$s. Define $$$dp[i][sm][p]$$$ as in first $$$i$$$ $$$f$$$s you placed $$$p$$$ tokens and their sum is $$$sm$$$, this dp has at most $$$10*55000*1000$$$ states, transitions are in $$$O(1)$$$.

    Now you just sum $$$dp[x][sm][n]$$$ such that $$$min[sm] = m$$$

    273592555

    • »
      »
      »
      7 недель назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

      This might also help.

    • »
      »
      »
      7 недель назад, # ^ |
        Проголосовать: нравится +8 Проголосовать: не нравится

      i had about the same idea but the 10*55000*1000 dp sounds really scary to me

      • »
        »
        »
        »
        7 недель назад, # ^ |
          Проголосовать: нравится +21 Проголосовать: не нравится

        in fact, if you limit $$$sm$$$ to $$$n\cdot fib_i$$$ (instead of $$$n\cdot fib_x$$$), the total number of states is only $$$n^2\sum_{i=1}^x fib_i=1.43\times10^8$$$, so it runs really fast :D

»
7 недель назад, # |
  Проголосовать: нравится +6 Проголосовать: не нравится

Man A screwed me

  • »
    »
    7 недель назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    really I thought A was really easy I just thought that chose the substring with longest repeating chars and just insert the different char than the present one in between of that substring

    • »
      »
      »
      7 недель назад, # ^ |
      Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

      now I realised that we don't need to find even longest substring though just find 2 repeating chars and insert the different char in between them. I am such a noob :(

      • »
        »
        »
        »
        7 недель назад, # ^ |
          Проголосовать: нравится 0 Проголосовать: не нравится

        It's ok I first understood that it requires minimum time and implemented a brute force solution and got wa1 and then sent another solution still wa1 and then realized it wanted maximum

  • »
    »
    7 недель назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    I also WA in test1 2 times and chuckles. I know today im gonna screw up by not having enough time again

  • »
    »
    7 недель назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    I was thinking why the time limit was 2 seconds. I literally did not make any sense.

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Why do a lot of people (including me) fail the 19 in D test?

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

someone please tell how to solve E

  • »
    »
    7 недель назад, # ^ |
      Проголосовать: нравится +11 Проголосовать: не нравится

    do it in different ways when $$$x \le \sqrt n$$$ and when $$$x \gt \sqrt n$$$. The former can be pre-calculated, while the latter can be solved by binary searching on prefix-sum

    • »
      »
      »
      7 недель назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

      Wow I didn't think of that

    • »
      »
      »
      7 недель назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

      but what is the prefix sum?

      • »
        »
        »
        »
        7 недель назад, # ^ |
        Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

        One observation is that, when $$$x \gt \sqrt n$$$, the level would never exceed $$$\sqrt n$$$. Then we can calculate prefix sum on the number of monsters having level $$$ \ge k$$$, for all $$$k$$$ s from 1 to $$$\sqrt n$$$ —- the monsters to encounter having level k

        UPD: Sorry, got hack on this. The complexity is actually $$$O(q\sqrt n \log n)$$$, approximately 10x slower than $$$O(n \log^2 n)$$$ for $$$n = q = 2e5$$$, maybe not fast enough even for a time limit of 4s. One mending might be brute-force to $$$h = 2000$$$ instead of $$$\sqrt n$$$ (Than the overall complexity would be $$$O(hn + \frac{n}{h}q\log n)$$$ which is $$$\lt O(q\sqrt n \log n)$$$)

    • »
      »
      »
      7 недель назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

      I did exactly that and got TLE on testcase 63

  • »
    »
    7 недель назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    You can precalculate an array of indices for each $$$k$$$, where the indices show where the last update of level happened. I did it with merge sort tree in $$$O(n \cdot log^3_2{n} + q \cdot log_2{n})$$$.

  • »
    »
    7 недель назад, # ^ |
    Rev. 2   Проголосовать: нравится +1 Проголосовать: не нравится
    Spoiler
  • »
    »
    7 недель назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    i have an idea that we can group the queries by k
    then for each can simulate the game by using segment tree in $$$O((n / k) log(n))$$$
    so we can do this in $$$O(n * log^2(n))$$$
    someone please correct me if i'm wrong.

  • »
    »
    7 недель назад, # ^ |
    Rev. 5   Проголосовать: нравится +21 Проголосовать: не нравится

    Notice that the level you can reach by the $$$i$$$-th monster is non-increasing as $$$k$$$ increases.

    Let $$$need_i$$$ represent the minimum $$$k$$$ for which our level will be $$$\leq a_i$$$ when we reach the $$$i$$$-th monster.

    We can binary search on the value of $$$need_i$$$. To check if $$$need_i \leq k$$$, we want to know if the number of monsters we would have fought till $$$i - 1$$$ is $$$\lt k \cdot a_i$$$, or formally $$$\text{cnt}(need_j \leq k$$$ where $$$j \lt i) \lt k \cdot a_i$$$.

    To check this $$$cnt$$$ quickly iterate in increasing order of $$$i$$$ and store the values of $$$need_i$$$ in a fenwick tree, then $$$\text{cnt}(need_j \leq k$$$ where $$$j \lt i)$$$ is just $$$sum(k)$$$.

    Code — 273568637

    • »
      »
      »
      7 недель назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

      can you elaborate on how to find for each k i.e we want to know if the number of monsters we would have fought till i−1 is <k⋅ai, or formally cnt(needj≤k where j<i)<k⋅ai. can you explain this

    • »
      »
      »
      7 недель назад, # ^ |
        Проголосовать: нравится +1 Проголосовать: не нравится

      won't it be non-increasing??

  • »
    »
    7 недель назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    Check my comment.

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Bad round, seriously

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

How do I approach problem D?

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

What is the idea for E?

  • »
    »
    7 недель назад, # ^ |
    Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится
    • »
      »
      »
      7 недель назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

      can you please explain

      • »
        »
        »
        »
        7 недель назад, # ^ |
        Rev. 4   Проголосовать: нравится +17 Проголосовать: не нравится

        If a $$$k$$$ doesn't scare monster $$$i$$$, then all $$$k+1, k+2, ...$$$ won't scare it. Therefore you can binary search on $$$k$$$ and find how many monsters are also not scared with a segment tree (or Tree Order Statistics), thus finding the level you're going to be at at this index with a specified value $$$k$$$.

        273560444

        • »
          »
          »
          »
          »
          7 недель назад, # ^ |
            Проголосовать: нравится 0 Проголосовать: не нравится

          I don't understand why we used a sum segment tree for this problem. If I want to determine whether a specific value $$$K$$$ can scare the fourth monster in the array $$${x, y, z, M}$$$, how does knowing the sum of $$$x$$$, $$$y$$$, and $$$z$$$ help me decide that? I think the ordering of the three numbers might differ. Sorry if I misunderstood the code.

          • »
            »
            »
            »
            »
            »
            7 недель назад, # ^ |
            Rev. 3   Проголосовать: нравится -8 Проголосовать: не нравится

            We are not summing the values themselves, but we are rather calculating the amount of monsters at indices $$$1...i-1$$$ that would not be scared with a value $$$k$$$.

            That can be calculated by storing the minimum $$$k$$$ we found for indices $$$1...i-1$$$ in another array $$$freq$$$, where $$$freq_j$$$ denotes how many monsters stay when $$$k = j$$$ but leave when $$$k < j$$$. We will then query for $$$\sum_{l=1}^{k} freq_l$$$.

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

why my code failed for D ? link my solution

»
7 недель назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится
»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

instant system test complete???

»
7 недель назад, # |
  Проголосовать: нравится +26 Проголосовать: не нравится
»
7 недель назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

$$$O(NX + N^2/X\ log(N))$$$ should be enough to E? I chose $$$X = 1000$$$, and I saw in the worst case it would do like $$$9\times 10^8$$$ operations, and the code executed fast enough, 640ms.

First brute force up to 1000 (ordering queries), then the next I solved doing binary searches in prefix sum to each level up to 200, to find the point of each upgrade.

  • »
    »
    7 недель назад, # ^ |
      Проголосовать: нравится +8 Проголосовать: не нравится

    I think in E you can actually optimize the large $$$k$$$ case using harmonic sums so it becomes $$$O(n\sqrt{n}+nlog^2(n))$$$. i.e. for each level only iterate $$$k$$$ up to $$$\frac{n}{l}$$$ (or so).

  • »
    »
    7 недель назад, # ^ |
      Проголосовать: нравится +20 Проголосовать: не нравится

    You can solve E in $$$O(nlog^2n)$$$, for each $$$i$$$ you can define $$$f(i,x)$$$ as 0 if $$$i$$$ runs for value $$$k=x$$$ or 1 if $$$i$$$ doesn't run for value $$$k=x$$$. See that $$$f$$$ is monotonic so you can binary search it. ($$$f(i,0)=0$$$ for all $$$i$$$ for implementation sake)

    Go through all elements and binary search $$$x$$$ such that $$$f(i,x)=0$$$ and $$$f(i,x+1)=1$$$, in order for element $$$i$$$ to run for some $$$x$$$ there should be $$$a[i]*x$$$ elements that don't run on prefix. You can use ordered set, for calculating how many elements stay/run on prefix. Answering queries is straight forward just compare $$$ans[i]$$$ with $$$x$$$. 273562301

  • »
    »
    7 недель назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    I solved in your complexity. I TLEd under X=1000 and ACd with X=2000.

  • »
    »
    7 недель назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    It can be solved in $$$O((n+q)\sqrt n)$$$ without Binary Search if you maintain both prefix sums and lists of indices that need fight for each $$$k \leq \sqrt n$$$: 273605589.

    I had to use $$$2\sqrt n$$$ for the brute force part to get the memory under 512MB :/

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Everyone is doing binary search for D while I did entry and exit times with lazy minimum segment tree lol

  • »
    »
    7 недель назад, # ^ |
      Проголосовать: нравится +1 Проголосовать: не нравится

    Hahahha what, I solved it with basic DFS

    • »
      »
      »
      7 недель назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

      Yea I overcomplicated it so much I basically just took the minimum in the whole tree and if its a leaf then break otherwise i take the minimum in the minimums subtree (not including the minimum) and lets call that mn2 i increase minimum by (mn2-mn+1)/2 and decrease everything in its subtree by that. I keep repeating until the minimum is the leaf then i just increase root by the minimum in the whole tree other than the root.

  • »
    »
    7 недель назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    I solved same way

  • »
    »
    7 недель назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    Same but the segment tree not lazy ahaha

  • »
    »
    7 недель назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    i ditched binary search because i kept getting WA with it lol

»
7 недель назад, # |
  Проголосовать: нравится +5 Проголосовать: не нравится

man...penalty sucks

»
7 недель назад, # |
  Проголосовать: нравится +10 Проголосовать: не нравится

As a pupil, I'm hoping to reach legendary grand master after this contest. Wish me luck!

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Worst contest ever taken...

»
7 недель назад, # |
  Проголосовать: нравится +1 Проголосовать: не нравится

Всем привет, очень интересная ситуация была в этом раунде. Как известно условие второй задачи было изменено после старта соревнований. Что произошло у меня: После решения первой задачи открыл вторую. Далее прочитав условие начал её решать, с оригинальным условием(без изменений) на решение задачи уходило на порядок больше времени(у меня). После того как условие изменилось ко мне не пришло уведомление от CF о том что условие изменилось на странице где я работал(оно пришло на другую страницу), как следствие я потратил час на решение задачи которая по итогу не существовала(и не дорешал). Потом чисто случайно обновил страницу и увидел изменение условия и уведомление на другой открытой вкладке CF. После этого быстро решил эту задачу и ещё одну. Никаких претензий к CF. Как предложение может стоит сделать уведомление на все страницы CF пользователя, а не только на одну? Обидно выходит, что я потратил время на решение не существующей задачи из-за того что уведомление не отработало. А так может быть решил бы и больше)))). Я понимаю как сложно организуются раунды CF, но хотелось бы чтобы подобных ситуаций было меньше. Вдруг я не один такой))))

»
7 недель назад, # |
  Проголосовать: нравится +6 Проголосовать: не нравится

B question was very poorly written i thought if i am not able to do b then how can i do C and further question , it took my whole contest time . Only because it wasnt mentioned clearly that in the starting only at most 1 region is given.

»
7 недель назад, # |
  Проголосовать: нравится +22 Проголосовать: не нравится

who else got WA test 19 on D for binary searching ??

»
7 недель назад, # |
  Проголосовать: нравится +2 Проголосовать: не нравится

one of the worst rounds I have ever done, especially B, I couldn't do it while I solved C in 5mins.

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

I don't understand why B .x.x. .x.x. this circumstance's answer is 0; it should be 6 because any '.' could be the answer , I am so mad that the author don't speak clearly

»
7 недель назад, # |
Rev. 5   Проголосовать: нравится 0 Проголосовать: не нравится

Ignore

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Lol I got cooked in a for starting the matching character check from 1 to n and not 0 to n.

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Why do I always RE on the D question?(Python)

  • »
    »
    7 недель назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    u need to extend the recursion limit for that

    • »
      »
      »
      7 недель назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

      I've used sys.setrecursionLimit(1000000)

      • »
        »
        »
        »
        7 недель назад, # ^ |
          Проголосовать: нравится 0 Проголосовать: не нравится

        Unlike C++, the stack size of Python runtime is fairly small (I think it's 1MB that's Windows' default), and this doesn't change even if you call sys.setrecursionlimit(), so heavily recursed solutions will get RE anyway.

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Can someone please check my 2 solution for D and tell me where i could optimize i'm feel defeated at it please anyone spare few minutes on my solution if u want i can explain what i did in my code

Submission 1 TLE Submission 2 MLE

»
7 недель назад, # |
  Проголосовать: нравится +10 Проголосовать: не нравится

it was more like div 2.5

»
7 недель назад, # |
  Проголосовать: нравится +6 Проголосовать: не нравится

worts round for me :( all my progress is gone in just one contest. B was so poorly written, and i couldnt figure out the integer overflow on D. why do i even do cp lmao

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

for problem D i wrote this solution:

It got failed at test case 19:

can anyone tell me what's wrong with it

#include <bits/stdc++.h>
using namespace std;
#define ll long long

bool calculate(vector<vector<ll>>&adj,vector<ll>&vec,ll node,ll mid)
{
    if(adj[node].size()==0)
    {
        if(vec[node]>=mid)
            return true;
        return false;
    }
    ll temp = max(mid-vec[node],1ll*0);
    if(node !=1)
        temp = temp + mid;
    bool ans = true;
    for(int i =0;i<adj[node].size();i++)
    {
        ans = ans & calculate(adj,vec,adj[node][i],temp);
    }
    return ans;
    
}
int main() {
	// your code goes here
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t;
    cin>>t;
    while(t--)
    {
        int n ;
        cin>>n;
        vector<ll>vec;
        vec.resize(n+1);
        vector<vector<ll>>adj(n+1);
        for(int i = 1;i<=n;i++)
        {
            cin>>vec[i];
        }
**        for(int i =2;i<=n;i++)**
**        {**
**            ll p;**
**            cin>>p;**
**            adj[p].push_back(i);**
**        }**
**        ll lo =vec[1], hi = 2e9+1;**
**        while(lo<hi)**
**        {**
**            ll mid = (lo+hi+1)/2;**
**            if(calculate(adj,vec,1ll*1, mid)){**
**                lo = mid;**
**            }**
**            else**
**            {**
**                hi = mid-1;**
**            }**
**        }**
****       
**        cout<<lo<<endl;**
****        
**    }**
**}**
»
7 недель назад, # |
  Проголосовать: нравится -13 Проголосовать: не нравится

Could a solution with time complexity $$$O(n \cdot \log(n)^4)$$$ pass for E or would it be too slow?

»
7 недель назад, # |
Rev. 4   Проголосовать: нравится 0 Проголосовать: не нравится

I thought in problem E O(Nlog^3(N)) would fit in TL, but it didn't :/ Submission Can finding the next index from current index i for which count of monsters >= current level is equal to k be done in O(log(N))? I tried binary search + fractional cascading in O(log^2(N))

  • »
    »
    7 недель назад, # ^ |
      Проголосовать: нравится +3 Проголосовать: не нравится

    Hi fellow Sarthak.

    It looks like the runtime of your solution is more to the effect of O(n^2/k) rather than O(nlog^3(n)) since you have nested for loops (iterating by 1 and ~ k respectively).

    The approach I took was to find the smallest k for which monster i could fight Monocarp, each in O(log^2n) time (hint: I used a binary search + seg tree). This allowed queries to be answered in O(1). Hope this helps :)

  • »
    »
    7 недель назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    I did it in$n \cdot log^3_2{n}$ by walking on the segment tree.

  • »
    »
    7 недель назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    Yes, you can do it similarly to the range k-th order statistic problem.

    Let $$$b_{x,i} = [a_i \ge x]$$$ for $$$x \in [1, n]$$$, i.e. each $$$b_x$$$ is an array that contains $$$1$$$s on the positions where $$$a_i \ge x$$$ and $$$0$$$s on the rest. Now, let's build a range sum point update segment tree $$$T_x$$$ on each of those arrays $$$b_x$$$. Finding the next index is just a matter of descending $$$T_x$$$, where $$$x$$$ is the current level, but building those trees naïvely is too slow. However, if you make those trees persistent, then all you need is to build $$$T_n$$$ in $$$\mathcal O(n)$$$ (since level does not exceed $$$n$$$), and then $$$T_x$$$ can be obtained from $$$T_{x+1}$$$ by replacing $$$0$$$s with $$$1$$$s in the positions $$$i$$$ where $$$a_i = x$$$. Since you do $$$\mathcal O(n)$$$ point updates in total, the construction of all $$$T_x$$$ works in $$$\mathcal O(n \log n)$$$.

    I don't know if my code is readable, but just in case: 273556813.

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Всем привет, очень интересная ситуация была в этом раунде. Как известно условие второй задачи было изменено после старта соревнований. Что произошло у меня: После решения первой задачи открыл вторую. Далее прочитав условие начал её решать, с оригинальным условием(без изменений) на решение задачи уходило на порядок больше времени(у меня). После того как условие изменилось ко мне не пришло уведомление от CF о том что условие изменилось на странице где я работал(оно пришло на другую страницу), как следствие я потратил час на решение задачи которая по итогу не существовала(и не дорешал). Потом чисто случайно обновил страницу и увидел изменение условия и уведомление на другой открытой вкладке CF. После этого быстро решил эту задачу и ещё одну. Никаких претензий к CF. Как предложение может стоит сделать уведомление на все страницы CF пользователя, а не только на одну? Обидно выходит, что я потратил время на решение не существующей задачи из-за того что уведомление не отработало. А так может быть решил бы и больше)))). Я понимаю как сложно организуются раунды CF, но хотелось бы чтобы подобных ситуаций было меньше. Вдруг я не один такой))))

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Please can someone explain what is the error in this appoach for D 273594204. although i know this is failing in test case one only but i am doing the same thing what question says or am i interpreting it wrong please someone explain

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

I had this idea for D, but couldn't submit it in time. But I keep getting a runtime error on test 19. I'm using Python; can anyone see what's wrong with this submission? My submission to D (RE on test 19)

  • »
    »
    7 недель назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    recursion limit 1e5

    • »
      »
      »
      7 недель назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

      Still didn't work. I even increased it to 2e5, but that gave memory limit exceeded

      • »
        »
        »
        »
        7 недель назад, # ^ |
          Проголосовать: нравится 0 Проголосовать: не нравится

        I've found a solution. A bootstrap function I copied from @pajenegod, a GM who uses Python. It manages the call stack manually, and avoids recursion limit errors. I actually had it in my template, but didn't think to use it until now. It was accepted :)

        Thanks. Feel free to check out my template (or pajenegod's code, I just don't know where to find it) for the bootstrap function. You can then use it as a decorator for the recursive function, and replace all your return statements with yield to get it to work

        @pajenegod orz, once again

»
7 недель назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

can anyone tell why this code for problem D failed at test case 19:

#include <bits/stdc++.h>
using namespace std;
#define ll long long

bool calculate(vector<vector<ll>>&adj,vector<ll>&vec,ll node,ll mid)
{
    if(adj[node].size()==0)
    {
        if(vec[node]>=mid)
            return true;
        return false;
    }
    ll temp = max(mid-vec[node],1ll*0);
    if(node !=1)
        temp = temp + mid;
    bool ans = true;
    for(int i =0;i<adj[node].size();i++)
    {
        ans = ans & calculate(adj,vec,adj[node][i],temp);
    }
    return ans;
    
}
int main() {
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t;
    cin>>t;
    while(t--)
    {
        int n ;
        cin>>n;
        vector<ll>vec;
        vec.resize(n+1);
        vector<vector<ll>>adj(n+1);
        for(int i = 1;i<=n;i++)
        {
            cin>>vec[i];
        }
        for(int i =2;i<=n;i++)
        {
            ll p;
            cin>>p;
            adj[p].push_back(i);
        }
        ll lo =vec[1], hi = 2e9+1;
        while(lo<hi)
        {
            ll mid = (lo+hi+1)/2;
            if(calculate(adj,vec,1ll*1, mid)){
                lo = mid;
            }
            else
            {
                hi = mid-1;
            }
        }
       
        cout<<lo<<endl;
        
    }
}

»
7 недель назад, # |
  Проголосовать: нравится +2 Проголосовать: не нравится

OOf. I solved B for the general case where multiple regions are present. Took me 50 minutes to come up with solution. At that point C already had like 6k solves. Thought solving D will help but nope. Ended up with a Pupil level performance even after solving D. D should not have more than 2k solves imo(even if we take into account how standard it is). Hope the cheaters get pruned.

  • »
    »
    7 недель назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    In question B,it is said that the given grid contains at most 1 connected region;

  • »
    »
    7 недель назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    Yaa i was also thinking about the general case first and using bfs in problem B Also problem D was a bit standard problem but still 5k submissions in quite high. Anyways best of luck for the next contest

  • »
    »
    7 недель назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    What was your approach for solving the general case?

    • »
      »
      »
      7 недель назад, # ^ |
      Rev. 2   Проголосовать: нравится +3 Проголосовать: не нравится

      Assuming that there are multiple regions present you can do a bfs on the grid to identify and mark all regions. Blocks belonging to region 1 will be marked with the value 1 and so on. While you do this you also have to keep track of the size of every region(can be done using a map). Now the only conditions are: 1. There is one region and we use the editorial logic. 2. There are 4 regions and regions made of a single cell can be blocked to make the total regions equal to 3. 3. Lastly if you have 2 regions and you block a cell such that a region gets divided into 2 regions. 4. The number of regions is 3 and you block a cell in a region which has a size greater than 1(I missed this case actually). If the number of regions is greater than 4 then blocking one block will not be enough. I might be wrong tho.

      • »
        »
        »
        »
        7 недель назад, # ^ |
          Проголосовать: нравится +1 Проголосовать: не нравится

        it's messy for the when there are 3 regions. You can only block the end points of regions. Apart from that I also don't think there can be cases for greater than 4 regions. Your solution seems correct to me.

»
7 недель назад, # |
  Проголосовать: нравится +6 Проголосовать: не нравится

Overflow may be the cause of the Wa test19 on D. When recording the value that needs to be provided to the parent node, it is essential to verify whether this value exceeds the upper limit that the subtree can provide. Otherwise we can construct a case such that all the a_i equals to 0 and the value being transmitted could be vey big.

»
7 недель назад, # |
  Проголосовать: нравится +1 Проголосовать: не нравится

how come 12k solved c. is it that easy.

  • »
    »
    7 недель назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    it was easier than B

  • »
    »
    7 недель назад, # ^ |
      Проголосовать: нравится +9 Проголосовать: не нравится

    Cheaters most probably, no matter how easy it was aint no way 12k people solved it suddenly. Also I noted that it happened too quickly. One moment my rank is 2.5k, within minutes it's 6k. But whatever.

»
7 недель назад, # |
  Проголосовать: нравится +3 Проголосовать: не нравится

Problem D if you WA on test19,please check your data scale. In the process of DFS,when the val exceed 1e9 you should return the process.

  • »
    »
    7 недель назад, # ^ |
      Проголосовать: нравится +5 Проголосовать: не нравится

    Can u explain why the if check is required, overflow issue ??

    • »
      »
      »
      7 недель назад, # ^ |
      Rev. 5   Проголосовать: нравится 0 Проголосовать: не нравится

      Maybe your solution is different to his,no need for the if check,but

      If you use binary search to solve D.Being able to construct data where all a_i values are 0 would result in leaf nodes requiring very large values, causing them to exceed the range of 'long long'.

  • »
    »
    7 недель назад, # ^ |
    Rev. 3   Проголосовать: нравится 0 Проголосовать: не нравится

    i got it.

»
7 недель назад, # |
  Проголосовать: нравится +3 Проголосовать: не нравится

I guess I should re-learn how to read statements after implementing a much harder version of problem B and then deleting almost all of it...

(But please, something as important as "at most 1 connected region" should be bold or in capital letters, or have a bigger font size, whatever, the next time around please...)

»
7 недель назад, # |
  Проголосовать: нравится +1 Проголосовать: не нравится

Is $$$O(nlog^3(n) + qlog(n))$$$ enough to pass E? If it is, could someone explain why my submission got TLE?

  • »
    »
    7 недель назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    I also got TLE. Try Fenwick tree, it works for me.

  • »
    »
    7 недель назад, # ^ |
      Проголосовать: нравится +4 Проголосовать: не нравится

    Your precomputation step's complexity is actually $$$O(nlog^4n)$$$.

    For each of the $$$O(nlogn)$$$ level changes you do a binary search which adds a $$$O(logn)$$$, and your query method has $$$O(logn)$$$ calls, and calling lower_bound inside adds an extra $$$O(logn)$$$.

    I actually had the same issue, the query method can be changed so that the binary search is done inside the query.

    • »
      »
      »
      7 недель назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

      Ok I miscalculate the time complexity, my bad :(

    • »
      »
      »
      7 недель назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

      Could you explain the way to modify those binary search inside the query?

      • »
        »
        »
        »
        7 недель назад, # ^ |
          Проголосовать: нравится +1 Проголосовать: не нравится

        Instead of just returning a count you can return a count and also the position where it is reached. Also there is a maximum count you don't want to exceed and you need to remove a prefix which is not within the range of the query. You can take a look my submission

      • »
        »
        »
        »
        7 недель назад, # ^ |
        Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

        To do this you can use a method called 'Walk on segment tree'. Basically it uses the structure of the segment tree in such a way that you don't have to do an additional binary search. You can read about it from here.

        I slightly modified your submission to use this concept and got AC:273649483

        As you can see, instead of using the qry method along with binary search, I made another method called qry2 which makes use of walk on segment tree.

  • »
    »
    7 недель назад, # ^ |
    Rev. 2   Проголосовать: нравится +1 Проголосовать: не нравится

    that is around O(N log(N)^4 + Q log (N)), you may want to use walk on the merge sort tree to cut off a log(N) coefficient.

    • »
      »
      »
      7 недель назад, # ^ |
        Проголосовать: нравится +3 Проголосовать: не нравится

      Okay, I just remember about the "finding the kth largest problem" and know how to walk on the merge sort tree. Thanks for your help.

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

my best ever contest. First time abcd solve in div. 2. authors were also very nice, I had a very nice and friendly interaction with them while asking questions. Overall, loved the contest but ngl, D was a little bit easier

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

I don't think I've ever blundered this hard in a contest, forgot a return statement in A and forgot to check one cell in B, so by 53 mins I had only C solved + multiple WAs for A and B. (+ I couldn't find the issue in B till the end of the contest :( )

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Can you guys please try to hack This Solution

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

For D , find the maximum value a node can have such that the values of all its subtree nodes is atleast same as that value . Now for root , its value (at max) can be increased by the minimum of the final node value of all its childs .

Code

»
7 недель назад, # |
  Проголосовать: нравится +3 Проголосовать: не нравится

Some people like problems like B, but I think such subtle statements in the problem statement reduce readability. It becomes more about reading the problem than actually solving it. (Might just be skill issue)

»
7 недель назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится
»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

D : For all the nodes u, find the maximum value they can have such that all the nodes in their subtree will have the final values atleast equal to the final value of node u . Now for root , the maximum increase in its value is " the minimum of the final values of all its childs " .

Code

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Recently cheating has increased quite a lot on CodeForces although problem D was bit standard more like leetcode contest hard question(6 pointer not 7 or 8) but still 5k submissions is really high, the contest went really well for me but still got around 2.7k rank. I have been stuck at specialist rating for some time now due to the high level of cheating. Hope CF will increase action on these cheater

  • »
    »
    7 недель назад, # ^ |
      Проголосовать: нравится +1 Проголосовать: не нравится

    i wanna know they got the question before the contest or they interact each other ? how they do this ?

    • »
      »
      »
      7 недель назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

      I guess these solutions are shared in telegram groups during the contest due to some companies using coding platform rating as screener but still it gets really unfare for genuine users

  • »
    »
    7 недель назад, # ^ |
      Проголосовать: нравится +9 Проголосовать: не нравится

    I definitely think a person being stuck at a rank has more to do with their skill level than cheating.

    It is not that people have stopped becoming experts, have they? We should focus on what we can focus on, rather than finding excuses.

  • »
    »
    7 недель назад, # ^ |
      Проголосовать: нравится +5 Проголосовать: не нравится

    While cheating is absolutely a thing, I don't think attributing being stuck at a certain rating point to it is a good idea. What you're essentially claiming is that 5k people couldn't have solved D, casting doubt at each person with an AC.

    • »
      »
      »
      7 недель назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

      Sorry didn't meant it like that just wanted to point that cheating does effect user rating as such assuming even just 5-10% users cheat. I understand it might also be difficult for codeforces due to high number of false positives in a stricter plag checker Also as you are a candidate master can you suggest mistakes to avoid and increase ones problem solving skill with time

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

awoo orz.

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

for D i try binary search and dfs .it looks right but i wa on 19 for 3 times so sad :(

»
7 недель назад, # |
  Проголосовать: нравится +24 Проголосовать: не нравится

D without binary search and overflow —

Let $$$dp[i] = $$$ maximum possible minimum value in the subtree of $$$i$$$ with optimal operations. We have —

$$$ dp[i] = \begin{Bmatrix} a[i] & \text{ if } i \text{ is a leaf} \newline \min\limits_{j \in \text{ child of } i}(dp[j]) & \text{ if } \min\limits_{j \in \text{ child of } i} (dp[j]) \leq a[i] \newline \left\lfloor\frac{a[i] + \min\limits_{j \in \text{ child of } i} (dp[j])}{2}\right\rfloor & \text{ if } \min\limits_{j \in \text{ child of } i} (dp[j]) > a[i] \newline \end{Bmatrix} $$$

Submission — https://codeforces.net/contest/1997/submission/273602376

  • »
    »
    7 недель назад, # ^ |
      Проголосовать: нравится +3 Проголосовать: не нравится

    I read your comment so I went to fix the overflow in my code and got Accepted, lol

  • »
    »
    7 недель назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    same approach. Fist bumps!

  • »
    »
    7 недель назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    Same here, however it is better to describe the approach instead of giving those formular, as it will be scare for people who didn't know how to do this.

  • »
    »
    7 недель назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    similar approach but I don't know why I stored it in a segment tree tho, kinda dumb xD and a waste of time!

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

can anyone help show me what's the wrong test in my solution problem D: 273557414. My idea was collecting points from leaf to root

  • »
    »
    7 недель назад, # ^ |
    Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

    nevermind I found the error, only put parents that have no child left into the queue. Skill issue again

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Long time without writing segtree at contest + bad approach (ignored few cases) cost me -3 at final standings.

Approach: let's solve problem offline for each $$$k$$$ in queries.

If $$$k\leq K$$$ (let's choose $$$K$$$ later), than solve with stupid method (just implement statement), requiring $$$O(n)$$$ for each $$$k\leq K$$$, overall $$$O(nK)$$$.

If $$$k>K$$$, there is at least $$$ceil(\frac{n}{k})$$$ monsters to be passed before level up. Since there, we can make $$$ceil(\frac{n}{k})$$$ steps for each $$$k>K$$$. Where $$$W$$$ -- magical constant, stated as time to be done following: gived fixed $$$r$$$ -- left edge of interval and $$$lvl$$$ -- our current lvl, find minimal $$$i\geq prev$$$, such that $$$count(a_j\geq lvl, r\leq j \leq i)=k$$$. It can be solved in $$$O(\log^2(n))=W$$$ time using segment tree storing sorted vectors of elements on array.

So, let's take $$$K=1000$$$ and final complexity is: $$$O(Kn+n\cdot \log(n)+\frac{qn\cdot \log^2(n)}{K})$$$

WA during contest: 273573012 OK: 273599991

»
7 недель назад, # |
  Проголосовать: нравится +4 Проголосовать: не нравится

It's sad to see that constraints on problem B were corrected(mentioned for the first time) around after half an hour.

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

I just solved D after the end by less than a minute, very sad

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

How do we solve D without binary search?

  • »
    »
    7 недель назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    Check my comment above.

  • »
    »
    7 недель назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    Yes, we could use greedy. Knowing that if we goes up to a root of some subtrees, those children in this subtree won't be higher (as the operation will make them decreasing by $$$1$$$ each time), so we will aim for maximizing the minimum of all value of this subtree (including the root of this subtree as well).

  • »
    »
    7 недель назад, # ^ |
    Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

    let dp[u] be the max smallest value of subtree u after doing operations

    for node u: without doing any operations then the min val would be min(A[u],dp[v]) where v are all the children

    you could spend one operation to increase A[u] but that would decrease dp[v] by 1

    so let a = A[u], b = min(dp[v]) if a > b then do nothing (aka dp[u] = b)

    otherwise do k operations until min(a+k,b-k) maximizes (which just so happens to be (b-a)/2 operations) -> dp[u] = min(a+(b-a)/2, b-(b-a)/2)

    for the root/final answer: you could freely do the operation so the answer is A[0] + min(dp[v])

  • »
    »
    7 недель назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    check my approach explained in this comment https://codeforces.net/blog/entry/132049?#comment-1177386

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

can anyone explain me no. B simply, what should i do?

  • »
    »
    7 недель назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    if you delete a cell then the most number of regions that can be created is the number of open cells that neighbours it directly -> it must have 3 empty neighbours

    now imagine this:

    1 v 3

    a 2 b

    v = the node you're deleting

    if a is an empty cell then region 1 and 2 are actually the same region so you'll only get at most 2 regions -> a must be blocked

    same for b and region 2+3

    so the answer is just the number of patterns that are either

    . . .

    x . x

    or

    x . x

    . . .

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится
Problem D using simple dfs 

Approach
now let's see the case when i would not like applying operation on root.. 

4 -> 4 -> 6 
1    2   3 

what i can do is .. apply operation on 3 .. so it would become 
4 -> 5 -> 5 
ans would be 9 .. 
so like i want all nodes to be equally in way you can say.. 

so i do dfs.. 
when i reach a node.. i first take min of all it's children. 
now if observer.. 
if node_value >= min_of_children then return min_of_children..   
as i can't make the children nodes largeer from parent.. 
if node_value < min_of_children 
    3      <    5 
    what i would do is.. diff = min_of_children - node 
    node_value += diff/2 
    then i return node_value 

so when i reach root node .. instead of focussing on returning .. 
i add whatever min value is coming from down to root's current value. 

// values[0] would be updated after this function called, return that
int dfs(int node)
{
    visited[node] = true;
    int min_value = INT_MAX;
    for (auto child : adj[node])
    {
        if (!visited[child])
        {
            int returned = dfs(child);
            min_value = min(min_value, returned);
        }
    }
    if (min_value == INT_MAX)
    {
        if (node == 0)
            return 0;
        min_value = min(min_value, values[node]);
    }
    else
    {
        if (node == 0)
        {
            values[node] += min_value;
            return 0;
        }
        if (values[node] < min_value)
        {
            int diff = min_value - values[node];
            values[node] += diff / 2;
        }
        min_value = min(min_value, values[node]);
    }
    return min_value;
}
  • »
    »
    7 недель назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    Nice approach. Even i did the same way..we do not need visited array if we make it directed graph.

»
7 недель назад, # |
  Проголосовать: нравится +4 Проголосовать: не нравится

very bad contest for me wasted almost 1 hour 40 minutes just because i thought x is capital and in the end i somehow figured out what was the mistake anyway cheating has been at it's peak today

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

my C,also too much cheating this time -70 solved a and b only getting 13k rank

Spoiler
»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Guys what was the statement for 4th problem I didn't understand and was not able to understand the third example test case

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

By the way, the custom invocation tab wasn't working today. I tried benchmarking my F to account for hardware differences, but it wasn't responding. Fortunately, it did not matter to me today, but you should probably fix it before the next big event.

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

I don't know who introduced the Cloudflare checking system to codeforces (to check if I'm a human), but I suffered the worst. The problemset was quite standard but it took me aound 7 minutes to enter the contest as 'The system was still checking if I'm a human'. Then after solving A, I could not submit any problem as the same problem kept happening. I tried mobile cf, other browsers, tried to change my net, nothing worked. I guess yeah, my network was quite slow but I could not enter the whole contest after that! I do not blame anyone but it was really a sad contest for me as I was quite hopeful I could solve upto D.

»
7 недель назад, # |
  Проголосовать: нравится +14 Проголосовать: не нравится

I don't know who introduced the Cloudflare checking system to codeforces (to check if I'm a human), but I suffered the worst. The problemset was quite standard but it took me aound 7 minutes to enter the contest as 'The system was still checking if I'm a human'. Then after solving A, I could not submit any problem as the same problem kept happening. I tried mobile cf, other browsers, tried to change my net, nothing worked. I guess yeah, my network was quite slow but I could not enter the whole contest after that! I do not blame anyone but it was really a sad contest for me as I was quite hopeful I could solve upto D.

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Idk why my code is giving RunTime error on a particular case Question D With exit code 1:

Here's my submission Submission

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Maybe anyone is interested in non-recursive solution for D, I did it during the contest because was afraid of hack, I thought that recursion depth of 2*10^5 will cause overflow. Also left there recursive function for comparison: https://codeforces.net/contest/1997/submission/273588364

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

any body knows how to fix the friend glitch, i am unable to add or remove anyone?

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Please check my approach for D, is it hackable or not ?? 273621989

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

For D , if you are getting WA on tc 19 then putting a boundary condtion that if required subtraction to be done in the subtree > 1e9 , return false may work.

»
7 недель назад, # |
  Проголосовать: нравится +6 Проголосовать: не нравится

For Q-D wa on testcase 19 , putting a condition in dfs function as a base case that if the required subtraction need to be done from the subtree > 1e9 , return false may work !!

»
7 недель назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

1

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Many people solved F with a Fibonacci idea. What was the actual idea?

Can someone link some blogs to read about it and also some problems of a similar idea.

TY in advance :D

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Greedy for D works too, basically we add to each node until that node is less than or equal to the minimum in its subtree (excluding itself). I did this during the contest

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Was quite happy to get my rating increased to 1296 after the rating rollback, my highest of all time and was hoping to become 1300+ today. For the first time did problem A in 10 mins. Then I saw problem B's submissions going exponentially like 6000 in the first 15 mins (were 4000 already after I solved A). Got really panicked because I knew I had to bring a rank under 6k for rating increase and at my stage I mostly bring it only from A and B. Still couldn't really figure out B after a long time and till the (the first 50 mins of the contest) it already had 12k ACs. A moment of self doubt came in post that and as for an additional problem, my codeforces would come to verifying you are a human screen and stayed like that for the rest of the contest. Opened it on other browsers and even on my mobile but still the same screen :(. I don't know if this problem happened just for me or everyone else. But the end I was just able to solve A and got a rank of 14500. I think I'd fall back to newbie after this. That proud green color over my name is probably gone now...

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

273574835 why my this solution for C is giving TLE?

  • »
    »
    7 недель назад, # ^ |
    Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

    String formed = "";

    formed += '(';

    The string concatenation is slow because the new string is created every time, you can use StringBuilder for better performance.

    StringBuilder formed = new StringBuilder("");

    formed.append('(');

    You can replace with these and submit again.

    • »
      »
      »
      7 недель назад, # ^ |
      Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

      damnn! it worked. thanks a lot!

      this is something new which I have came across. do you know any specific reason for this behaviour?

      • »
        »
        »
        »
        7 недель назад, # ^ |
          Проголосовать: нравится 0 Проголосовать: не нравится

        String in Java is immutable which means it can't be modified. The way it handles the update is to clone the current one to the new one, then apply the changes on this new one, then assign the result back to the original one. This performance would be really slow for big string and especially in the loop.

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

It's really a good round. Thank you!

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

my solution

Can somebody hack my solution?

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Where's the text solution?

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится
»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

I don't understand why the rank is decreasing during the hacking phase. Can anyone explain? I also loved the problems, seemed a bit east this time but I managed to fumble anyway. I made such a stupid mistake in D that I don't even mention it. If anyone is curious they can look at my failed submissions and laugh

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Can anyone explain why the rank is decreasing during the hacking phase? Thanks!

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

111

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Can anyone please help me find why below solution got me WA . I am binary searching on the maximum increment that i can do on the root node.


void dfs(ll vertex , vector<ll>adj[], ll vis[] ,ll value[] ,ll want ){ vis[vertex] =1 ; vector<ll>leaf ; for(auto child : adj[vertex ]) { if(!vis[child]){ leaf.push_back(child) ; } } if(leaf.empty() ){ value[vertex]-=want ; } else { value[vertex]-=want ; ll extra ; if(value[vertex] <0 )extra = abs( value[vertex] ) ; else extra =0 ; value[vertex]=max(value[vertex],0LL) ; for(auto child:leaf){ dfs(child,adj,vis,value,want+extra) ; } } } bool check(ll mid , vector<ll>adj[] , ll n ,ll val[] ){ ll value[n] , vis[n] ; for(ll i=0 ;i<n ;i++ ){ value[i] = val[i] ; vis[i] =0 ; } vis[0] =1 ; for(auto i : adj[0] ){ dfs(i,adj,vis,value,mid) ; } for(ll i=0 ;i<n ;i++ ){ if(value[i] <0 )return false ; } return true ; }

Thanks in advance....!

»
7 недель назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

Someone tell me why my solution to problem D is giving TLE? 273573102

  • »
    »
    7 недель назад, # ^ |
      Проголосовать: нравится +3 Проголосовать: не нравится

    When you call the function traversal, the function will make a copy of m. So if it is called n times, the m will be copyed n times, which will cause TLE. You can pass the reference of m to the function so it won't be copyed when you call the function.

    Spoiler
»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

second question was a quite tough for begginers maybe but finally i did it without using bfs. I use mapping for both strings and then solved it further.It was such satisfying and good experience. Thank you.

  • »
    »
    7 недель назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    i dont think it was tough , it was just a pattern that needed to be observed , if you can make a 'V'OR 'A'with x at the vertices, its done.

»
7 недель назад, # |
  Проголосовать: нравится -11 Проголосовать: не нравится

(B,C,D) <<<< A <<<<< (E,F)

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

I am a newbie.. Is this contest was not rated for me ??

»
7 недель назад, # |
  Проголосовать: нравится +21 Проголосовать: не нравится

F is a beauty!! loved that the Fibonacci is hidden in plain sight idea!! it had everything, memory optimization, knapsack, and lovely math.

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

"This round will be rated for the participants with rating lower than 2100." Is this contest was rated for newbie or not ??

»
7 недель назад, # |
  Проголосовать: нравится +1 Проголосовать: не нравится

D was a very great problem, but some of my friend get WA on the 19th test

»
7 недель назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

first time to solve problem D in contest, and hope to solve problem E in contest one day :)

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

as a tester, i wish you good luck, problems are good

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Hi, can somebody tell me about the complexity of 273675185

  • »
    »
    7 недель назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    $$$O(nlog^4{n})$$$ assuming the LTE function is $$$O(log^2{n})$$$, I don't know wavelet trees.

    • »
      »
      »
      7 недель назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

      I have used the implementation in this link. it says that, Counting elements less than or equal to $$$x$$$ in a given range is $$$O(\log {n})$$$.

      • »
        »
        »
        »
        7 недель назад, # ^ |
          Проголосовать: нравится 0 Проголосовать: не нравится

        Hmmm, that is very OP, what is the point of merge sort trees then?

        • »
          »
          »
          »
          »
          7 недель назад, # ^ |
            Проголосовать: нравится 0 Проголосовать: не нравится

          given that, the counting happens in $$$O(\log n)$$$ time. the complexity of this solution should be $$$O(n\log^3{n})$$$ . but it is giving TLE. can you spot any mistake in this.

          • »
            »
            »
            »
            »
            »
            7 недель назад, # ^ |
              Проголосовать: нравится 0 Проголосовать: не нравится

            I don't understand your code sorry. Are you sure that your complexity is $$$n log^3{n}$$$, I solved it in $$$n log^3{n}$$$, maybe your constant factor is too high.

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Editorial when?

»
7 недель назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

Очень странный взлом под номером 273657531 и такое ощущение что это специальный буст аккаунта. Так же нашёл этого участника 273656804

»
7 недель назад, # |
Rev. 3   Проголосовать: нравится +3 Проголосовать: не нравится

I am wondering why someone with red name is official participants. (20240731 08:05 GMT)

However, it said "This round will be rated for the participants with rating lower than 2100" in the announcement.

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

What is wrong with the following submission, it is giving a? as output for s = "a", locally it is working fine.

https://codeforces.net/contest/1997/submission/273676836

  • »
    »
    7 недель назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    Your first for loop starts from s.size()-2, but input size is 1. Maybe this causes undefined behaviour.

    • »
      »
      »
      7 недель назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

      Yeah, size returns unsigned it which causes the issue. Casting it to int solves the issue

  • »
    »
    7 недель назад, # ^ |
    Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

    In this part of your code:

            for (int i = s.size() - 2; i >= 0; i--)
            {
                if (s[i] == s[i + 1])
                {
                    n = i + 1;
                    break;
                }
            }
            if (n == -1)
            {
                char ch;
                if (s[s.size() - 1] == 'z')
                    ch = 'a';
                else
                    ch = s[s.size() - 1] + 1;
                cout << s;
                cout << ch << endl;
                continue;
            }
    

    The function s.size() returns the type of unsigned int, so it can't be negative.

    However, you have written int i = s.size() - 2.

    So $$$s.size() == 1$$$ and then $$$s.size()-2 < 0$$$.

    Therefore, $$$i$$$ becomes a extremely big number, then will be somewhere successfully match the scentence if(s[i]==s[i+1]), and $$$n$$$ will also become really big, that is, $$$n$$$ will not be $$$-1$$$.

    Thus, it cannot get into the block if(n==-1).

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Tricky but interesting problem F, enjoy it.

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Tricky but interesting problem F, enjoy it.

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

qp

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Good luck!I hope I can achieve green after this contest if I have time to participate in this contest.

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Heyy anyone solve D using BS?

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

I want to know that why system testing take much more time than div 1? Can you explain me?

  • »
    »
    7 недель назад, # ^ |
      Проголосовать: нравится +1 Проголосовать: не нравится

    First, open hacking phase adds an extra 12+ hours delay.

    Second, actually easier rounds (educational/div3/div4) are more appealing to lower-ranked people, which actually holds the majority of the users, resulting in more participations, and more codes to rejudge.

  • »
    »
    7 недель назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    This time especially was slower due to crazy amount of TL hacks on E, which was solved quite a lot for its position, and most of solutions on it used a few seconds on each test. Each solution alone took 5-15 minutes to be fully judged.

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Auto comment: topic has been updated by awoo (previous revision, new revision, compare).

»
7 недель назад, # |
  Проголосовать: нравится +9 Проголосовать: не нравится

Wow! Now everyone is rated for EDU!

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Is this round rated for DIV1 participants?

»
7 недель назад, # |
  Проголосовать: нравится +2 Проголосовать: не нравится

MikeMirzayanov Why was this contest rated for me even though I've long been a master??? I want my rating back.

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

it was better when you make the error

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

I found my contest submission had got a TLE, but when I resubmitted it after the system test, I passed. What's wrong with it?

contest submission, resubmission

  • »
    »
    7 недель назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    The running time depends. The running time of your resubmission is 3406ms, it's also very close to the time limit. So maybe submitting during the contest again also makes you accept.

    • »
      »
      »
      7 недель назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

      I was hacked after the contest, and as far as I know, resubmission doesn't count in the system test.

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Can anyone tell why contest official ranking hasn't removed red coders from standings, why they have given ranks in contest

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

How would i know which contest is rated for me and which is not?? Like an upcoming contest is Codeforces Round(Div 2), will it be rated for div 4??

  • »
    »
    7 недель назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    if ur rating is below 1400 then div4, div3, div2 are rated for u. if ur rating is below 1600 then div3, div2 are rated for u. if ur rating is below 2100 then div2 is rated for 4

»
7 недель назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

Failed to pass F during the contest but passed after finished 8min...

But I reach CM!!!

»
7 недель назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

I have one doubt regarding Problem E. In this problem when i used segmented tree my solution exceeded the time limit in test case 12 but when i did the same with fenwick tree it passed . Can anyone tell me the reason behind it? although the updation and query time complexity for both the data structure is same ,that is O(logN). 273965828 Fenwick Tree , 273964980 Segmented tree.