Evirir's blog

By Evirir, 5 weeks ago, In English
A drawing of Evirir the dragon
Art by Evirir

Hello / Selamat sejahtera / 你好 Codeforces! ^.=.^

We, CSQ31, Evirir, and YouKn0wWho, are excited to invite you to Codeforces Round 994 (Div. 2) on Dec/20/2024 17:35 (Moscow time)!

In this round, you will learn more about Evirir the dragon and help (or stop) them as they wreak havoc and escape from a wizard.

You will solve $$$6$$$ problems in $$$2$$$ hours.

The score distribution is $$$500 - 750 - 1000 - 1750 - 2250 - 2750$$$.

There will be at least one interactive problem, so please read the guide for interactive problems if you are unfamiliar with them.

We would like to thank everyone who made this round possible:

Fun fact: As far as we know, this is the first round by Malaysians since 2020 (last being Codeforces Global Round 10)!

UPD: The score distribution has been added.

UPD 2: Editorial

UPD 3: Congratulations to the Top 5!

Div. 2:

  1. rainboy
  2. not_natural_fruits
  3. Aestivate
  4. trunkty
  5. 1.618034

Div. 1 + 2:

  1. Rubikun
  2. arvindf232
  3. antontrygubO_o
  4. StarSilk
  5. Otomachi_Una
  • Vote: I like it
  • +152
  • Vote: I do not like it

»
4 weeks ago, # |
  Vote: I like it -9 Vote: I do not like it

nice

»
4 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

Do you really think i will solve them?

»
4 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

Hoping for a fun contest!

»
4 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

frist connemt :D

  • »
    »
    4 weeks ago, # ^ |
      Vote: I like it +46 Vote: I do not like it

    :'(

    a5887f6b89ac42783fdb6cc94ba55ce71d345761

    • »
      »
      »
      4 weeks ago, # ^ |
        Vote: I like it +25 Vote: I do not like it

      Well you see, the question of "who asked?" is simply a paradox. Since by asking "who asked?", you are implying that people need to be asked before speaking. However following that logic, you would have needed to have someone grant you permission to say that, because who asked you to say "who asked?" ? Exactly, nobody did, and nobody can ask anyone to give them permission to give you permission because no one asked them. And this perpetual loop never ends, creating a paradox.

      Created by @veryhungrydinosaur

»
4 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

hope you all get greens give your best with best wishes

»
4 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

orz Evirir

»
4 weeks ago, # |
  Vote: I like it +1 Vote: I do not like it

finally a contest with interactive, orz Evirir

»
4 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

don't make C as interactive make D or E or F

»
4 weeks ago, # |
  Vote: I like it +24 Vote: I do not like it

Interactive problems are fun to solve. Isn't it?

»
4 weeks ago, # |
  Vote: I like it +1 Vote: I do not like it

malaysian round lesgo

»
4 weeks ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

Hope no negative delta this time.

»
4 weeks ago, # |
  Vote: I like it +3 Vote: I do not like it

AAT, I really enjoyed the problems: it’s well-balanced and has something for everyone. Hope you all have fun solving it, too. GL orzz

»
4 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

judging by the drawing, this is going to be a banger [fire emoji lol]

»
4 weeks ago, # |
  Vote: I like it +12 Vote: I do not like it

the frog is so cute...oh! its a dragon,my bad

»
4 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

LOL☠️☠️

»
4 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

Let's go Malaysia

»
4 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

rawr

»
4 weeks ago, # |
  Vote: I like it -8 Vote: I do not like it

will not participate if interactive problem is A-C, sorry

»
4 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

What can we do for being a tester.

»
4 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

Eating delicious points!!!

»
4 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

orz CSQ31 orz Evirir rawr >////<

»
4 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

Malaysia let's go!!! Hopefully I get pupil after this contest.

»
4 weeks ago, # |
  Vote: I like it +1 Vote: I do not like it

Score distributions??

»
4 weeks ago, # |
  Vote: I like it +2 Vote: I do not like it

As a participant, i'm afraid of interactive problems

»
4 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

Cute dragon.

»
4 weeks ago, # |
  Vote: I like it +1 Vote: I do not like it

The FBI told me this round will indeed have problems.

»
4 weeks ago, # |
  Vote: I like it +1 Vote: I do not like it

You will solve 6 problems in 2 hours. Tks!

»
4 weeks ago, # |
  Vote: I like it +25 Vote: I do not like it

You will solve $$$6$$$ problems in $$$2$$$ hours.

Really? Meoww~~~~~~~~

»
4 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

Expected score distribution ?? anyone

»
4 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

Wait... 6 problems and 6 dragon balls? Are we summoning Shenron or debugging our way to a wish?

»
4 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

voila!

»
4 weeks ago, # |
  Vote: I like it +1 Vote: I do not like it

dont make interactive problem in A-C

»
4 weeks ago, # |
  Vote: I like it +3 Vote: I do not like it

Tahun baru kehidupan mu menjadi lebih baik

»
4 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

hope i will be able to solve 2 of them

  • »
    »
    4 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    were you? idk man, earlier i could atleast solve 2, now i cant even solve the second prob lol. ig imma noob. gotta grind frfr.

»
4 weeks ago, # |
  Vote: I like it +5 Vote: I do not like it

It's almost time guys,give us the score distribution.

»
4 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

beautiful

»
4 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

Chill guys, Evirir is busy with New year's shopping. He'll add score distribution soon :)

»
4 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

Score distributions?

»
4 weeks ago, # |
  Vote: I like it +1 Vote: I do not like it

I guess 4th problem will be interactive or any easy 3rd problem as interactive

»
4 weeks ago, # |
  Vote: I like it +5 Vote: I do not like it

SpeedForces incoming !!

»
4 weeks ago, # |
  Vote: I like it +38 Vote: I do not like it

MexForces

»
4 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

Is E binary search on k? If yes, how?

  • »
    »
    4 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    I am wondering the same question. I tried multiple ways, I mean n has a constraint of 2^30 and there are 33 queries so there must be some sort of way to binary search on answer.

  • »
    »
    4 weeks ago, # ^ |
    Rev. 3   Vote: I like it +24 Vote: I do not like it

    Yes, its binary search.

    Lets first split the array into 4 equal sized ranges. This is clearly possible since $$$n$$$ is a power of $$$2$$$ and at least $$$4$$$.

    If we queried these 4 ranges, we would either get back:

    • 3 "0"s and 1 "1", indicating that 1 represents the range with the hidden value, and thereby $$$\frac{n}{4} \lt k$$$. In this case, we binary search on the size of the range $$$[l, r]$$$, always ensuring it completely contains the range which returned $$$1$$$. Since this range will always contain the hidden value, the smallest size where the value becomes $$$0$$$ is your answer for $$$k$$$.

    • 3 "1"s and 1 "0", indicating that 0 represents the range with the hidden value, and thereby $$$\frac{n}{4} \geq k$$$. In this case, we binary search on the size of the range $$$[l, r]$$$, always ensuring it remains completely within any range which returned $$$1$$$. Since this range will never contain the hidden value, the smallest size where the value becomes $$$1$$$ is your answer for $$$k$$$.

    This naively takes $$$4$$$ queries for the first part + $$$30$$$ for the binary search which is $$$1$$$ too much. But we can notice that the result for the 4th segment can be uniquely obtained from the query results for the first 3 segments, reducing our total to $$$33$$$ queries.

    Code — 297544715

    • »
      »
      »
      4 weeks ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Nice problem, thanks

    • »
      »
      »
      4 weeks ago, # ^ |
      Rev. 2   Vote: I like it 0 Vote: I do not like it

      Nice problem and interesting solution!

      During the contest, I tried to split the array into $$$2$$$ equal sized ranges, then I was struggling with how to determine whether the return value is case $$$s(l, r)$$$ or case $$$1-s(l, r)$$$.

      I did not notice that by splitting it into $$$4$$$ equal parts, it is possible to identify the return value through counting number of $$$1$$$ and $$$0$$$. This is a really unexpected idea for me.

      Thanks for your prompt solution reply!

  • »
    »
    4 weeks ago, # ^ |
    Rev. 3   Vote: I like it 0 Vote: I do not like it

    I tried to first do 3 queries on range [1, n/4], [n/4+1, n/2], [n/2+1, 3*n/4]. That way you can find where the 1 is present and if k is greater or smaller that n/4.

    Afterwards ask for [1, n/2] in case k >= n/4. If with that you discover k >= n/2 then you search including the half you know contains the 1, otherwise you search in the half you know it has only 0s. This way you can binary search as the function changes from true to false at a single value which will be k.

    I think the idea is right but wasn't able to implement correctly, please let me know if somebody finds any flaws.

  • »
    »
    4 weeks ago, # ^ |
    Rev. 3   Vote: I like it +7 Vote: I do not like it

    I did 3 queries:

    1. with first query I can determine which of [1,n/2] and [n/2+1,n] gives answer 1 (because these two intervals have to give different answers.

    2. the chosen interval [l,r] is divided into two halves [l,m], [m+1,r] and they are queried.

    3. If those two answers are the same: that means [l,r] doesn't contain 1, and we also determine if k is in range [n/4+1, n/2] or [2, n/4].

    4. If the two answers are different: that means the [l,r] contains 1 and k is in range [n/2+1, n].

    In all these cases, the remaining part is very simple binary search on k.

»
4 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

Solving D too slow made me fail to return CM, nooooo...

»
4 weeks ago, # |
  Vote: I like it +8 Vote: I do not like it

F is cool

»
4 weeks ago, # |
  Vote: I like it +3 Vote: I do not like it

Question B's n constraint of 5000 kinda confused me for a bit, for a moment I thought it was brute force, tho it turned out O(n) is enough.

»
4 weeks ago, # |
  Vote: I like it +3 Vote: I do not like it

"Submit code for E": 0:00:09

The submit site done loading: contest over.

Screw me over....

»
4 weeks ago, # |
  Vote: I like it +8 Vote: I do not like it

agghhhhh, I solved B and C so slowly :( and just almost solved and implemented D in time.

  • »
    »
    4 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Slow specialist like us are tend to eat dust from the expert + CM. Time to upsolve and practice some more haha

»
4 weeks ago, # |
  Vote: I like it +14 Vote: I do not like it

this contest was a pain in the ass

»
4 weeks ago, # |
  Vote: I like it +3 Vote: I do not like it

Yeahhh!! There goes my rating .

»
4 weeks ago, # |
  Vote: I like it +4 Vote: I do not like it
  • »
    »
    4 weeks ago, # ^ |
      Vote: I like it +3 Vote: I do not like it

    Solved the latter 2 days back so this was a treat

»
4 weeks ago, # |
Rev. 3   Vote: I like it 0 Vote: I do not like it

why'd my go solution for A gives different output on cf?

works fine: https://ideone.com/UYCdmo

doesn't: https://codeforces.me/contest/2049/submission/297496814

»
4 weeks ago, # |
  Vote: I like it +5 Vote: I do not like it

MEX FORCES

»
4 weeks ago, # |
Rev. 2   Vote: I like it +6 Vote: I do not like it

Is there something wrong with the tests on D? Why did my N^4 solution passed?297536216

  • »
    »
    4 weeks ago, # ^ |
      Vote: I like it +3 Vote: I do not like it

    It could be TLE on the main tests.

    • »
      »
      »
      4 weeks ago, # ^ |
        Vote: I like it +3 Vote: I do not like it

      Somehow passed also. Monkalaugh Monkalaugh.

  • »
    »
    4 weeks ago, # ^ |
      Vote: I like it +3 Vote: I do not like it

    O(N^4) for N^2 == 50 000 and 2.5s sounds like it might actually fit. I might hate myself for not trying that solution... I literally thought about it...

»
4 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

How to C?

  • »
    »
    4 weeks ago, # ^ |
      Vote: I like it +1 Vote: I do not like it

    do MEX operation as problem said, repeat it 10 times (probably only need 3 times, but I rather 10) and you AC

    • »
      »
      »
      4 weeks ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      i cant wrap my head around the q, it requires u to perform mex on values whose values themselves need to be discovered by mex on other values

  • »
    »
    4 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Fix $$$x$$$ and $$$y$$$, then brute force every other position. You can see that there exists an answer with element value never greater than $$$3$$$.

    • »
      »
      »
      4 weeks ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Can you please elaborate a little bit,i couldn't understand why and how?

      • »
        »
        »
        »
        4 weeks ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        Without loss of generality, assume $$$(x, y)$$$ as $$$(1, y-x+1)$$$ (as the array is cyclic).

        We'll see that friends should have different value, thus we can fix $$$a_1 = 0$$$ and $$$a_{y-x+1} = 1$$$.

        Loop for all $$$i$$$ in range $$$[2, n]$$$ except $$$y-x+1$$$. Initially, $$$a_i = 0$$$. Keep increasing it until the first moment it is not equal to any of its known friends (known = elements that had been set before, that would be anything previous $$$i$$$, $$$1$$$ and $$$y-x+1$$$)

    • »
      »
      »
      4 weeks ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      You can also do it without ever using 3, i.e., using elements 0, 1 and 2 only.

  • »
    »
    4 weeks ago, # ^ |
    Rev. 2   Vote: I like it +1 Vote: I do not like it

    If $$$|x - y| = 1$$$, then if $$$n$$$ is odd, print $$$2, 1, 0, 1, 0, ....$$$, and if $$$n$$$ is even, print $$$1, 0, 1, 0, 1, ...$$$. If $$$|x - y| > 1$$$, if the number of dragon between $$$x$$$ to $$$y$$$ and $$$y$$$ to $$$x$$$ is even, then print $$$1, 0, 1, 0, 1, ...$$$, otherwise let $$$a_x = 2$$$, $$$a_{x + 1} = 1$$$, $$$a_{x + 2} = 0$$$, $$$a_{x + 3} = 1$$$, ... (I draw all of those cases and saw the answers LOL).

  • »
    »
    4 weeks ago, # ^ |
    Rev. 2   Vote: I like it 0 Vote: I do not like it

    If there wasn't another condition on x and y, then the trivial solution is

    • If n is even: 0 1 0 1 0 1 0 1 ... (0 1 repeating)
    • If n is odd: 0 1 0 1 0 1 ... 2 (0 1 repeating, then 2 at the end)

    But when there is another condition on x and y (And if they have the same parity), then you will have to make either a[x] or a[y] equal to 2 too. (Note: There is an edge case when n is odd and x == 1, y has the same parity as x, then you will have to make a[1] equal to 2 instead of a[n])

  • »
    »
    4 weeks ago, # ^ |
      Vote: I like it +1 Vote: I do not like it

    First, think about a simple cycle of size $$$n$$$. If $$$n$$$ is even, $$$[0, 1, 0, 1, \ldots, 0, 1]$$$ is an answer. If $$$n$$$ is odd ($$$n \ge 3$$$), $$$[0, 1, 0, 1, \ldots, 0, 1, 2]$$$ satisfies the condition.

    For this problem, there are at most two cycles in the graph, and they share exactly one edge. You can allocate $$$0$$$ and $$$1$$$ to the two vertices the shared edge connects, and do the above for each cycle individually.

»
4 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

How to solve C?

»
4 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

Thank you very much guys for the round. Much appreciated.

»
4 weeks ago, # |
  Vote: I like it +3 Vote: I do not like it

hopes shattered!

»
4 weeks ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

Ok, I'm absolutely stumped by WA on test 1 in E.

My submission correctly guesses "5" for the first sample case when run in Codeforces custom test and locally (tried compiling with both -g and -O2) but incorrectly guesses "4" when submitted.

All queries are small enough to safely verify by hand ((1, 2) --> 0, (3, 4) --> 0 and (5, 6) --> 1) or the responses are present in the sample ((4, 8) --> 1 and (3, 8) --> 0) so I doubt that's the cause of the issue.

I also don't see any obvious undefined behavior in the code:

Spoiler

Can someone help identify the undefined behavior (or mistake in my query responses) that are causing the difference?

Edit: I know there is a different bug in the code for the if(cnt_ones == 3) { block, but the samples don't run it.

  • »
    »
    4 weeks ago, # ^ |
      Vote: I like it +11 Vote: I do not like it

    For $$$k = 5$$$, the response for $$$(4, 8)$$$ would be $$$0$$$ since range contains $$$1$$$ $$$($$$at $$$6)$$$ and length $$$= 5$$$ is atleast $$$k$$$.

    • »
      »
      »
      4 weeks ago, # ^ |
      Rev. 3   Vote: I like it 0 Vote: I do not like it

      Oh, test case 1 and the sample are different...

      I looked at the output of test case 1 and the explanation of the sample even though those clearly make no sense together >.> (using $$$k = 6$$$ for calculations and considering $$$k = 5$$$ output correct lol, my brain was clearly fried today)

»
4 weeks ago, # |
  Vote: I like it +4 Vote: I do not like it

losing too much time on ABC sadly, could've have enough for solve 1 more but I can't... maybe next contest :(

»
4 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

Too much usage of mex. Had to try a lot of cases to figure out the pattern in C.

»
4 weeks ago, # |
  Vote: I like it +5 Vote: I do not like it

Is there beautiful solution in C? Because my solution is $$$ififififif$$$.

  • »
    »
    4 weeks ago, # ^ |
      Vote: I like it +4 Vote: I do not like it

    You can break the big cycle down into 2 small cycles defined as (1) in between x and y, and (2) outside x and y. ans[x] = 0, ans[y] = 1. Then, for each cycle, we separately start from y and work through the cycle back to x, just alternating the values being 0 and 1. If we return all the way back to x and find that we placed 0 and 0 adjacent to each other, we make that last-placed value a 2.

  • »
    »
    4 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    I don't know if it's a beautiful solution but here is my solution : 297477253. I know that a[i]<=2, so for each i, I create a set containing 0,1,2 and erase a[i-1], a[i+1], a[x], a[y] if I've already calculated their value, then I take the minimum (I have no proof of why it works but it seems logical).

    • »
      »
      »
      4 weeks ago, # ^ |
        Vote: I like it +5 Vote: I do not like it

      I have solved with 0,1 only and then use 2 for the x,y cases:

      for (int i = 0; i < n; i++) arr[i] = (i % 2);
          if (n & 1) arr[n - 1] = 2;
       
          if (x > y) swap(x, y);
          if (arr[x] == arr[y]) {
            if (x != 0) {
              arr[x] = 2;
            } else {
              if (n & 1) {
                arr[x] = 2;
                arr[n - 1] = 0;
              } else
                arr[x] = 2;
            }
          }
      
»
4 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

B >> C

  • »
    »
    4 weeks ago, # ^ |
      Vote: I like it +1 Vote: I do not like it

    I thought B > C too while at it, but when I realize a trick in B it's simple

    (I'm on panic af ngl, losing so much time shuffling between B-C, also losing too much unnecessary time on A because I'm late)

    • »
      »
      »
      4 weeks ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      I came up with some bs solution for b, what is the easy way to do it?

      • »
        »
        »
        »
        4 weeks ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        Brute force :3.

      • »
        »
        »
        »
        4 weeks ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        brute force it coz n is small. The idea is work around left bound and right bound of an element

        With every p or s, it limits the left/right bound. After that check if l<=r for all and no range is overflow (range of 2 can't contain 3 numbers)

        • »
          »
          »
          »
          »
          4 weeks ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          Breh, that's what I did... ig I was just trying to shortcut a check to find if any range was overflowed and thus took too much time instead of being patient.

          • »
            »
            »
            »
            »
            »
            4 weeks ago, # ^ |
              Vote: I like it 0 Vote: I do not like it

            I too, was panic so bad and losing too much time...

            I bet I can solve E with 30 more minutes sadly. (I pick E personally, coz I love interactives)

            • »
              »
              »
              »
              »
              »
              »
              4 weeks ago, # ^ |
                Vote: I like it 0 Vote: I do not like it

              Also, NOOOO! ... I just realized right now that my implementation of D was all correct except for saying that i = 1, I had to say i = 0. This actually sucks.

»
4 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it
  1. why do you hate python? D1
  2. what went wrong here? D2

?

  • »
    »
    4 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    ugh, ok, I get the error in D2, it's due to LL handling in cpp :(

»
4 weeks ago, # |
  Vote: I like it +7 Vote: I do not like it

Ad hoc forces, there goes my rating..

»
4 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

I suck so bad in solving DP problems, can you please share me best dp practice set apart from cses dp a problem/practice set with less no of problems but more to learn... plz

  • »
    »
    4 weeks ago, # ^ |
      Vote: I like it +1 Vote: I do not like it

    Exactly!! The standard dp is easy to identify but dp when in disguise like this, its becoming impossible for me to identify

    • »
      »
      »
      4 weeks ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Yup exactly, i am thinking to solve 1800 codeforces dp problems from now on then only i will become good in such problems

»
4 weeks ago, # |
  Vote: I like it +8 Vote: I do not like it
»
4 weeks ago, # |
  Vote: I like it +1 Vote: I do not like it

Can anyone help me understand B? i tried a brute force approach. 297536174

approach
  • »
    »
    4 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    I think it should be this: If there's an S that occurs after a P then you print NO.

    b/c everything after the s needs to be [1,2,...] and everything before the p needs to be [1,2,...]. You can't put the #1 in two places.

    If there's an S before a P then you are OK. EXCEPT for an edge case where there's a space before the s and a space before the p. .sp. is NO sp.... is YES ....sp is YES.

    • »
      »
      »
      4 weeks ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Yeah i was wayy to confused in the test case sp giving YES and .sp. giving NO. I understood the reason hence i went for the implementation through indexes, I am still a little confused if there exists more such edge cases. If Yes how do i tackle them? IF no, then If i use your implementation of only checking for 1 edge case .sp. will it be AC?

      • »
        »
        »
        »
        4 weeks ago, # ^ |
        Rev. 2   Vote: I like it 0 Vote: I do not like it

        My implementation checks for more than just .sp. by checking if s is at index 0 or p is at index str.size()-1.

        (First time really using the comment section so I think this is how I link my submission: https://codeforces.me/contest/2049/submission/297512367 I handle the edge case on lines 20-25.)

        Edit: (Also heads up, I think the comment I left there (line 22) is wrong so ignore it).

»
4 weeks ago, # |
  Vote: I like it +1 Vote: I do not like it

Is D Dijkstra?

  • »
    »
    4 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    It's DP

    • »
      »
      »
      4 weeks ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      sauce of your profile pic?

      • »
        »
        »
        »
        4 weeks ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        It's an anime called Orb: On the Movements of the Earth. It's about astronomy research in medieval times, similar to Vinland Saga in terms of dark stuff. If you want to watch, don't read anything about it online because there are a lot of spoilers for the first few episodes.

        • »
          »
          »
          »
          »
          4 weeks ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          Thanks will keep that in mind

  • »
    »
    4 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Dijkstra can be used only in cases where the answer is monotonic.

    • »
      »
      »
      4 weeks ago, # ^ |
        Vote: I like it +8 Vote: I do not like it

      I did Dijkstra correctly, but it's a bit slower than DP.

      • »
        »
        »
        »
        4 weeks ago, # ^ |
        Rev. 4   Vote: I like it +3 Vote: I do not like it

        Your one already crosses O((n*m)^2) using three states and one loop. Its answer is monotonic.

        I am talking about two states in which the answer is not monotonic.

        • »
          »
          »
          »
          »
          4 weeks ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          Fair, thanks for pointing this out. Can you clarify in what sense the answer is not monotonic here?

    • »
      »
      »
      4 weeks ago, # ^ |
        Vote: I like it +4 Vote: I do not like it

      I didn't understand, what do you mean by "monotonic"?

  • »
    »
    4 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    It's possible to Dijkstra this but it's essentially encoding the DP transitions as a graph and you get an extra log factor

»
4 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

Can Someone Share Hint or Idea of Question C ?

  • »
    »
    4 weeks ago, # ^ |
    Rev. 4   Vote: I like it 0 Vote: I do not like it

    Someone mentioned it in another comment, but I did the same thing: 1. First find a way to make a valid MEX cycle without the additional constraint of x and y being friends:

    if n is even: 0,1,0,1,0,1..

    if n is odd: 0,1,0,1,...,2.

    e.x.

    n = 4 --> [0,1,0,1]

    n = 5 --> [0,1,0,1,2].

    When you add in the constraint that x and y are friends:

    n is even --> check if x and y are already valid (x = 0, y = 1 or vice versa). If not, then make one of them 2.

    n is odd --> just rotate the array so x or y is the number 2.

»
4 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

My solution of $$$E$$$:

Note $$$left = ask(1, \frac{n}{2})$$$ and $$$right = ask(\frac{n}{2}+1, n)$$$, we can see exactly one of the following conditions holds:

  1. $$$ask(1, n-1) \neq left$$$;
  2. $$$ask(2, n) \neq right$$$.

Then we can choose either $$$[1, m]$$$ or $$$[m, n]$$$ to perform binary search.

Sadly can not implement in time ;)

»
4 weeks ago, # |
Rev. 2   Vote: I like it -21 Vote: I do not like it

Feels like this round took a slight difficulty spike compared to usual! Some of the problems required a deeper level of observation and optimization, especially under the time pressure. That being said, it's always satisfying to tackle challenges like these—props to the problem setters for making us think harder! Good luck to everyone still grinding through the problems!

»
4 weeks ago, # |
  Vote: I like it +1 Vote: I do not like it

»
4 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

I'm not sure if I should be happy that I solved A or sad that I could only solve A?

»
4 weeks ago, # |
  Vote: I like it +1 Vote: I do not like it

Contest How much rating you want to lose?

Me: Yes

  • »
    »
    4 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    You actually gained +1

    • »
      »
      »
      4 weeks ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Weird. Maybe got lucky. I was expecting -50 or more.

      • »
        »
        »
        »
        4 weeks ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        Same here. I was expecting a -25 but got a +21

        • »
          »
          »
          »
          »
          4 weeks ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          How do you interpret the rating?

          • »
            »
            »
            »
            »
            »
            4 weeks ago, # ^ |
              Vote: I like it 0 Vote: I do not like it

            Just a guess. Seeing how my rating dropped/increased in previous contests as per my rank.

»
4 weeks ago, # |
  Vote: I like it +8 Vote: I do not like it

Screencast of me solving in rust (4k would be ready a bit later)

»
4 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

Is Mass Destruction the reference of A?

  • »
    »
    4 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    wow I didn't even think about it, very nice.

  • »
    »
    4 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    I was thinking of doing this problem a few days ago. Could have saved an hour today!

»
4 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

where is the rating? i can't play fortnite bc i waiting for my first pupil is 3 of 6 enough(i solved B on 4 or 5 attempt)

  • »
    »
    4 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    shit, i already played 3 games with my bro, 2 consecutive victory royals. sorry

    • »
      »
      »
      4 weeks ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      yeah my first pupil, goddamn i love all of you guys, now i want to malaysia

»
4 weeks ago, # |
Rev. 2   Vote: I like it +18 Vote: I do not like it

Codeforces Hot News!

Wow! Coder chenlinxuan0226 competed in Codeforces Round 994 (Div. 2) and gained -160 rating points taking place 4892

Share it!

»
4 weeks ago, # |
  Vote: I like it +1 Vote: I do not like it

Solution for d using recursive dp anyone?

»
4 weeks ago, # |
  Vote: I like it -10 Vote: I do not like it

But we are not natural fruits :(

»
4 weeks ago, # |
  Vote: I like it +3 Vote: I do not like it

Too hard question for Div2 A. Hadn't expected this :(

»
3 weeks ago, # |
  Vote: I like it -8 Vote: I do not like it

This in regard for the my solution to problem 2049C of this round.

I got a notification regarding the coincidence of the solution. This was due the coincidence of the algorithm used in the problem. I wrote the code myself. Also the style of writing the code matches with my previous submissions.

I request the Codeforces Team to review my submission. Evirir

»
3 weeks ago, # |
Rev. 2   Vote: I like it -12 Vote: I do not like it

I received a mail regarding submission of problem c that it matched with some other person's submission but my code is not similar to them only the approach can be same which can be trivial you can view my solution — https://codeforces.me/contest/2049/submission/297535805

I deserve the ratings for this contest. Evirir

»
3 weeks ago, # |
Rev. 2   Vote: I like it +12 Vote: I do not like it

Subject: Clarification Regarding Plagiarism Accusation for Problem 2049B in Round 994 (Div 2)[contest:994][problem:2049B]

Dear Codeforces Team,

I hope this message finds you well. I recently received a notification regarding my solution (ID: 297506801) for problem 2049B, stating that it significantly coincides with solutions Keylime/297472936 and tinytroubles/297506801. This notification has deeply concerned me, and I am writing to provide evidence and clarify that I did not engage in plagiarism.

Evidence Supporting My Case: Independent Work:

I worked independently throughout the contest and did not collaborate or share my code with anyone. Submission History:

My submissions demonstrate the evolution of my solution: Incorrect Submission 1: https://codeforces.me/contest/2049/submission/297498579 (submitted at 20:56 UTC+5.5)297498579 Incorrect Submission 2: https://codeforces.me/contest/2049/submission/297500380 (submitted at 20:59 UTC+5.5)297500380 Accepted Submission 3: https://codeforces.me/contest/2049/submission/297506801 (submitted at 21:08 UTC+5.5)297506801 These submissions were made within close time intervals, showing a logical progression in my thought process. Geographical and Logistical Impossibility of Collusion:

I am from India, while the flagged participant Keylime is from South Korea (Chung-Ang University). There is no possibility of communication or collaboration between us during the contest. Coincidence in Logic:

The flagged solution (https://codeforces.me/contest/2049/submission/297472936)[submission:297472936] appears to share similarities with mine. However, given the nature of competitive programming and the brevity of the problem’s solution, it is not uncommon for different participants to independently arrive at similar implementations. Additional Evidence:

If required, I can provide timestamps, drafts, and any other supporting materials to further substantiate my claim of independent work. Request for Re-evaluation: While I understand the importance of plagiarism checks to maintain the integrity of the platform, I believe this coincidence is an unfortunate case of two participants independently arriving at similar solutions. I respectfully request a thorough review of my case, as well as stronger measures to distinguish coincidental overlaps from actual violations.

Thank you for your attention to this matter. Please let me know if additional information is needed. I hope this can be resolved fairly and with due consideration.

Best regards, tinytroubles,tinytroubles ... expecting a change Evirir

»
3 weeks ago, # |
  Vote: I like it +12 Vote: I do not like it

This is my own implementation, and I have not shared my code with anyone or used any online tools like ideone. I implemented it entirely locally on my computer and followed my personal template, which I developed myself and use regularly for contests. Below is the template I used:

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

void solution() {

}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    int test;
    cin >> test;
    while(test--) {
        solution();
    }

    return 0;
}

And here is the full code I submitted for problem B:

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

void solution() {
    ll n;
    string s;
    cin >> n >> s;

    bool flag = true;

    bool p_exist = false;
    for(ll i = 0; i < n; i++) {
        if(s[i] == 'p') {
            p_exist = true;
        }
        if(s[i] == 's' && p_exist) {
            flag = false;
            break;
        }
    }

    bool s_exist = false;
    for(ll i = 1; i < n - 1; i++) {
        if(s[i] == 's') {
            s_exist = true;
        }
        if(s[i] == 'p' && s_exist) {
            flag = false;
            break;
        }
    }

    if(flag) {
        cout << "YES\n";
    } else {
        cout << "NO\n";
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    int test;
    cin >> test;
    while(test--) {
        solution();
    }

    return 0;
}

I received a message stating that my solution (link) is similar to another participant's solution (link).

The similarity might be due to the simplicity of problem B, which naturally leads to similar approaches among participants. Additionally, I submitted my solution approximately one hour earlier than the flagged solution, which supports that this is a coincidence.

I strictly adhere to Codeforces rules and have not engaged in any behavior that violates them. Please let me know if any further clarification is needed.


»
3 weeks ago, # |
  Vote: I like it -12 Vote: I do not like it

Subject: Clarification Regarding Solution Similarity for Problem 2049B

Dear Codeforces Team,

I received a notification regarding the similarity between my solution (ID: 297524944) and others. I would like to provide clarification:

  1. Independent Work: I wrote the solution independently during the contest. The problem involves verifying if a permutation satisfies specific conditions for characters p, s, and ., which led me to use a simple counting and conditional approach.
  1. Explanation of Similarity:

The logic of counting occurrences of p and s in the string and making decisions based on their counts and positions is a straightforward approach to solving this problem.

Many participants might have arrived at similar implementations due to the nature of the problem and the limited complexity of the solution space.

  1. Evidence:

My solution was developed on my local machine without exposure to public platforms.

I used standard techniques, and there was no sharing or reference to external sources during the contest.

I have learnt competative programming from a very popular youtube channel "luv". Here's is the link to his playlist https://youtube.com/playlist?list=PLauivoElc3ggagradg8MfOZreCMmXMmJ-&si=vpQNTKNBhLNGmWFT It is very popular playlist among college students so my variable and coding style may match with others.

I am committed to following Codeforces rules and am happy to provide more details if needed. Please let me know if additional clarification is required.

Thank you for reviewing this matter.

Sincerely, [smerkii]

»
3 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

This in regard for the my solution to problem 2049B(solution-297500190) of this round.

Please check the code as i always use this type of variables in all my submissions before Kindly recheck it for further clarifiation.

Also problem 2049A is also skipped and I haven't got any notification yet.