MLA19's blog

By MLA19, 8 months ago, In English

Hola, Codeforces!

We're glad to invite you to take part in Codeforces Round 1056 (Div. 2), which will start on Oct/05/2025 19:35 (Moscow time). You will be given 6 problems and 2 hours to solve them. At least one of the problems is interactive, so please read the guide for interactive problems if you are unfamiliar with them.

This round is based on the 30th edition of the Mexican Olympiad in Informatics (OMI).

Please note the unusual starting time.

The problems were authored and prepared by jampm, efishel, Marckess, JuanPabloAmezcua, IvanBorquez, SebR, Teto and me. We hope you enjoy the round as much as we enjoyed setting it!

The team would like to thank:

Score distribution: 500 — 1000 — 1750 — 2000 — 2250 — 3000

We wish you happy coding and good luck to all participants!

UPD 1: Added score distribution and new testers.

UPD 2: Added notice about interactive problems in the round.

Congratulations to the winners!

  1. misty
  2. Mirali777
  3. BlackLily
  4. AI-qv4rk
  5. trigger.cpp
  6. AKBEROV
  7. dingdong
  8. shade34
  9. CAMOBAP31
  10. aucoder123

UPD 3: Editorial is out! Sorry for the delay.

  • Vote: I like it
  • +189
  • Vote: I do not like it

»
8 months ago, hide # |
Rev. 3  
Vote: I like it +99 Vote: I do not like it

»
8 months ago, hide # |
 
Vote: I like it +16 Vote: I do not like it

As a tester I tested :thumbs_up:

»
8 months ago, hide # |
 
Vote: I like it +38 Vote: I do not like it

As a tester, I want a taco :)

»
8 months ago, hide # |
 
Vote: I like it +33 Vote: I do not like it

Yo espero que el concurso sea muy bueno

»
8 months ago, hide # |
 
Vote: I like it +25 Vote: I do not like it

Gray tester here.

»
8 months ago, hide # |
Rev. 6  
Vote: I like it -8 Vote: I do not like it

Hope to have good problems!

»
8 months ago, hide # |
 
Vote: I like it +24 Vote: I do not like it

Hope the problems are as interesting as the last Mexican Round. It was worth it to wake up late night and attempt the contest.

»
8 months ago, hide # |
Rev. 3  
Vote: I like it +41 Vote: I do not like it

As a problemsetter, +67

»
8 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Hope to get good problems, and be specialist.

»
8 months ago, hide # |
 
Vote: I like it +3 Vote: I do not like it

Hope to have good problems and get expert!

»
7 months ago, hide # |
 
Vote: I like it +2 Vote: I do not like it

everyone wish __baozii__ good luck for his midterms so that he can do well and become a tester again

»
7 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

[user:JuanPabloAmezcua]Taco, Tortilla, Burrito

»
7 months ago, hide # |
 
Vote: I like it +3 Vote: I do not like it

As a gray tester. I tested

»
7 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Happy Mid Autumn Festival!

»
7 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

burito

»
7 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

We will never have a global shortage of Burritos now!

»
7 months ago, hide # |
Rev. 2  
Vote: I like it -40 Vote: I do not like it

As a tester, i tested?

»
7 months ago, hide # |
 
Vote: I like it +3 Vote: I do not like it

1750 after 1000?

we are cooked

»
7 months ago, hide # |
Rev. 3  
Vote: I like it 0 Vote: I do not like it

As a non-Mexican participant, I can say burritos aren't as good as people say.

»
7 months ago, hide # |
 
Vote: I like it +9 Vote: I do not like it

As a Tester, hope you enjoy the round!

Thanks to the writers

»
7 months ago, hide # |
 
Vote: I like it +22 Vote: I do not like it

As a tester, I'm scared of problem A

»
7 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

I really want to play this match, but I might be half an hour late.

»
7 months ago, hide # |
 
Vote: I like it +9 Vote: I do not like it

As a participant, Good luck to everyone!

»
7 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

is it rated?

»
7 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Try out this extension, https://marketplace.visualstudio.com/items?itemName=DevXSayan.cf-submitter all problems of a contest inside vscode, code faster, run test cases and submit like a pro – all without leaving VS Code!

»
7 months ago, hide # |
 
Vote: I like it +10 Vote: I do not like it

I hope to be expert again :)

»
7 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

How is the time of a contest specified?

»
7 months ago, hide # |
 
Vote: I like it +21 Vote: I do not like it

OMI was the direct inspiration for OCI in Costa Rica, so good job guys on making these opportunities for students :D

»
7 months ago, hide # |
 
Vote: I like it +1 Vote: I do not like it

Contest will start in 10 minutes, so best luck for everyone :)

»
7 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Finally! A contest that is actually at a good time for PST (US & Canada) coders such that you do not have to wake up at like 4-6 am and is also on a weekend! Thank you!

»
7 months ago, hide # |
 
Vote: I like it +1 Vote: I do not like it

Thanks To Organizers!

»
7 months ago, hide # |
 
Vote: I like it +3 Vote: I do not like it

I have lost 300 elo and fell off 2 colors in 4 contests. AMA!

»
7 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

What's the deal with TC14 for D :'(

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

we're failing system testing with this one

»
7 months ago, hide # |
 
Vote: I like it +30 Vote: I do not like it

I think the sole purpose of modulo 676767677 in problem C was to let us know that it is a prime no. :))

Spoiler
»
7 months ago, hide # |
Rev. 2  
Vote: I like it +65 Vote: I do not like it

authors while writing div2C


Spoiler

»
7 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

how to do C? spent total time on it but couldn't figure it out

  • »
    »
    7 months ago, hide # ^ |
     
    Vote: I like it +1 Vote: I do not like it

    Tracking changes while iterating from left-right: by caseworking all 4 cases of 2 adjacent ones, you'll notice that the amount of seen wizards can change by at most 1 => if it's >=2, it is bullshit

    Basically, for the other situations: If the amount of seen wizards are the same across the entire array, some simple casework is sufficient (again, just write the case for N=3 and N=4 out).

    Otherwise, when the amount of seen wizards differs by at most 1 between 2 adjacent elements, you can identify at least 1 wizard, and from that reconstruct the entire sequence. After that, just slap some prefix sums to check whether the sequence is consistent to the input or not

»
7 months ago, hide # |
 
Vote: I like it +7 Vote: I do not like it

Absolutely RAGING ON D! T_T

»
7 months ago, hide # |
Rev. 2  
Vote: I like it +1 Vote: I do not like it

I didn't know div2C so I wrote brute force and saw that answer is always <= 2

so I made some observations from that brute force lmao .. fingers crossed for system test.

is there a cool way to solve this problem easily ?

  • »
    »
    7 months ago, hide # ^ |
     
    Vote: I like it +1 Vote: I do not like it

    See tourist's code
    It's amazing

    • »
      »
      »
      7 months ago, hide # ^ |
       
      Vote: I like it +1 Vote: I do not like it

      OK .. very cool..

      I understand it because of the observations I made, so able to make some sense, except that accumulate thing ..

      This is truly amazing to me, how clear the thought process is when writing that code.

      • »
        »
        »
        »
        7 months ago, hide # ^ |
         
        Vote: I like it 0 Vote: I do not like it

        i am unable to see anyone else's code, it shows N/A when i click on their submission, any fix?

        • »
          »
          »
          »
          »
          7 months ago, hide # ^ |
           
          Vote: I like it 0 Vote: I do not like it

          oh I am not sure why, but maybe you need to get some more rating to see other's code ??

          but pasting here for your reference


          Tourist's submission for problem C
»
7 months ago, hide # |
 
Vote: I like it +3 Vote: I do not like it

What happens in problem E in the following situation?

Starting grid:
2 2 2
1 2
2 2

Mimo cannot directly place the token in column 1, because it results in a loss, so WLOG we get
x0
x2.

Then Yuyu cannot directly place token in column 2, so we get
x1
x1.
The game then continues indefinitely. What have I misinterpreted?

  • »
    »
    7 months ago, hide # ^ |
     
    Vote: I like it +3 Vote: I do not like it

    you can't go up or down on the first move, the first move always has to be the left (last condition in the statement)

    • »
      »
      »
      7 months ago, hide # ^ |
       
      Vote: I like it 0 Vote: I do not like it

      Thanks, misread it by "only the last cell can be in column 1". Makes sense now.

»
7 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Wasted a whole lot of time, trying to prove the answer of problem A. and lol modulo 676767677 lmao

  • »
    »
    7 months ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    yeah very tricky... I just guessed and luckily it passed pretest

    how did you prove correct answer for A ?

    • »
      »
      »
      7 months ago, hide # ^ |
       
      Vote: I like it 0 Vote: I do not like it

      i just gave up and simulated and it passed :(

    • »
      »
      »
      7 months ago, hide # ^ |
       
      Vote: I like it +9 Vote: I do not like it

      Suppose that all games have been played except the final one.

      • The person left in the winners bracket hasn't lost yet.
      • The person left in the losers bracket has lost just once.
      • All the other $$$n - 2$$$ people lost twice.

      The final match produces another loss, so the number of total losses in the whole tournament is $$$1 + 2 (n-2) + 1 = 2 (n-1)$$$. This is equal to the number of total matches.

    • »
      »
      »
      7 months ago, hide # ^ |
      Rev. 3  
      Vote: I like it +1 Vote: I do not like it

      Let f(n) denote number of games played when there are n teams. We add a new team, let's call it n+1. It can be shown that this team adds exactly 2 more games to f(n). It contributes 1 game when it plays initially and 1 game to be eliminated. If it wins the tournament(i.e never gets eliminated) or is the winner of the loser's bracket, it contributes 1 extra game to beat the winner of the tournament or the winner of the loser's bracket when there were n teams. So f(n+1)=f(n)+2. f(2)=2. So f(n)=2*(n-1).

»
7 months ago, hide # |
 
Vote: I like it +3 Vote: I do not like it

Very nice B

»
7 months ago, hide # |
 
Vote: I like it +31 Vote: I do not like it

Screencast with commentary (once it is processed)

»
7 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

i don ' t know why my B can 't be accepted

»
7 months ago, hide # |
 
Vote: I like it +3 Vote: I do not like it

Problem C reminded me of 1952E - Sweep Line

»
7 months ago, hide # |
Rev. 2  
Vote: I like it +2 Vote: I do not like it

Thanks the mod 676767677 for forcing me to think about dp for 1 hour straight. Also, for problem D, I literally write the code (Poor Me).

Spoiler

Overall great round.

»
7 months ago, hide # |
 
Vote: I like it +11 Vote: I do not like it

How to solve D,i saw submissions of top contestants and everyone is querying pairs with increasing absolute difference but WHY does that work and how does SO MANY people know it?

  • »
    »
    7 months ago, hide # ^ |
    Rev. 2  
    Vote: I like it +5 Vote: I do not like it

    Assume there is no pair of adjacent batteries with $$$|i-j| \leq \frac{N}{a}$$$ (assume cyclic array). Then you must have $$$0, \frac{N}{a}+1, \frac{N}{a}*2+2, ..., \frac{N}{a}*a+a$$$. Contradiction, thus there must exist a pair within that distance

  • »
    »
    7 months ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    Actually, I managed to solve D purely by luck because of a calculation mistake. My basic idea was that if there are a active batteries, then the minimum distance between two active ones should be n / (a — 1), and the number of queries needed should be n^2 / (a — 1). Somehow, during the contest, I miscalculated it as n^2/a, and by some miracle, it still got accepted. I’d really love to hear a proper proof from someone else.

  • »
    »
    7 months ago, hide # ^ |
    Rev. 3  
    Vote: I like it 0 Vote: I do not like it

    If the minimum battery gap is k, then the maximum number of possible batteries is n/k.
    In this case, using this method, you need a maximum of n*k attempts.
    since n^2/(n/k) = nk, this works.

  • »
    »
    7 months ago, hide # ^ |
     
    Vote: I like it +6 Vote: I do not like it

    For me I thought about it as querying pairs in some order so that you will take less queries in the worst case when $$$a$$$ is large. Then I realized that when $$$a$$$ is large, the numbers are close together (in all my worst case examples I'd put the batteries at the end next to eachother). That made me realize you should probably query pairs close to eachother first to maximize the chance you find a working pair when $$$a$$$ is large.

    Once you've got that guess you can show it meets the bound by noticing the smallest possible abs difference is $$$\lfloor \frac{n}{a} \rfloor$$$ and you make less than $$$n$$$ queries for each difference

    • »
      »
      »
      7 months ago, hide # ^ |
       
      Vote: I like it 0 Vote: I do not like it

      Thanks! Great explanation.

    • »
      »
      »
      7 months ago, hide # ^ |
       
      Vote: I like it +3 Vote: I do not like it

      could you please help me with this case. Suppose n = 40, a = 3, and the positions of battery is {1, 20, 40}. If I query {i, i + d}, starting from d = 1. Since the distance between two pair is 19. So I have to query d = [1, 18], which takes (39 + 38 + ... 22) queries, but it's more than 40 * 40 / 3 = 533. Do I make a mistake, get a bit confused here.

  • »
    »
    7 months ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    Pigeonhole principle means that there must be a pair with gap at most $$$\lfloor \frac{n}{a} \rfloor$$$ (assuming cyclic array)

»
7 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

couldn’t able to think of a single approach for C.

anyways good problems.

»
7 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Are there any dp solutions for problem C apart from constructive algorithms? (although it must be less feasible) The problem seems dp-able (as it is asking for the total number of ways) and many problems exist a way to overkill it despite difficulty (It will be fascinating as it usually involves fancy algorithms I have never heard of). However I struggled to find an available dp state in O(n) or O(n log n) and wasted over half an hour on it. Thanks!

  • »
    »
    7 months ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    I don't think so because you would need to check the whole array to see that the numbers match

  • »
    »
    7 months ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    I did it with a kind of dp submission

    • »
      »
      »
      7 months ago, hide # ^ |
      Rev. 2  
      Vote: I like it 0 Vote: I do not like it

      Could you please explain briefly how your dp work? I guess $$$dp[dir][i]$$$ is the number of valid arrangements for first $$$i+1$$$ wizards where wizard $$$i$$$ has cape with direction $$$dir$$$, and $$$see[][]$$$ is some sort of prefix "visibility count", but I'm getting a bit lost on how you use it to compute the number of valid configurations.

      No worries if you're busy, but any extra insight you could provide would be a HUGE help!

      • »
        »
        »
        »
        7 months ago, hide # ^ |
         
        Vote: I like it 0 Vote: I do not like it

        see[][] is the necessary information to make a valid transition from dp[x][i-1] to dp[y][i-1]. 0 represents ( and 1 represents ), so see[x][i].f is the number of ( from [0, i] and see[x][i].s is the number of ) from [i+1, n)

»
7 months ago, hide # |
 
Vote: I like it +5 Vote: I do not like it

Is F just sqrt-decomposition by color occurence frequency?

  • »
    »
    7 months ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it
    Spoiler
    • »
      »
      »
      7 months ago, hide # ^ |
       
      Vote: I like it +24 Vote: I do not like it

      This TLed for me

      • »
        »
        »
        »
        7 months ago, hide # ^ |
         
        Vote: I like it 0 Vote: I do not like it

        This is the reality for every sqrt problem :|

        Maybe my solution isn't that good after all. My friend had a solution only with Mo, and it didn't pass for some reason

    • »
      »
      »
      7 months ago, hide # ^ |
       
      Vote: I like it +8 Vote: I do not like it

      Well, looks like another one reason to finally learn Mo on trees :)

      My idea was :

      Spoiler
      • »
        »
        »
        »
        7 months ago, hide # ^ |
         
        Vote: I like it +5 Vote: I do not like it

        $$$s \sqrt s log (n + q)$$$ is :skull:

        something sqrt something is barely squeezable

        • »
          »
          »
          »
          »
          7 months ago, hide # ^ |
           
          Vote: I like it -8 Vote: I do not like it

          I agree, but both logarithms come from using map/set, and since we can encode pair of verticies with 64-bit int, maybe it can run fuster with good hash-table...

          Also, first part is absolutely clear from any $$$\log$$$ part, so we can squeeze a little bit more by moving $$$\sqrt{s}$$$ border

          Well, with such number of optimization ideas, the best thing I can do right now is just try to implement all of this

          • »
            »
            »
            »
            »
            »
            7 months ago, hide # ^ |
            Rev. 2  
            Vote: I like it +2 Vote: I do not like it

            I've implemented your solution during the contest, got TL38: 342115514.

            I was 1 minute short to submit the same solution with custom hash map during the contest, did it now and it passed in 999ms :( 342123758

            UPD: Checked through mashups that the first solution works in 5.7s, 6 times difference is crazy.

            • »
              »
              »
              »
              »
              »
              »
              7 months ago, hide # ^ |
               
              Vote: I like it -8 Vote: I do not like it

              std::unordered_map is indeed too slow, it practically has no difference with std::map considering time constant, it's a pity that your solution got TL :(

              But, anyways, good job!

      • »
        »
        »
        »
        7 months ago, hide # ^ |
        Rev. 2  
        Vote: I like it -8 Vote: I do not like it

        Mo on trees doesn't work here because lca is accounted separately, so it takes $$$|c_{lca}|$$$ for each query which can be a lot

  • »
    »
    7 months ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    I think about that too but due to the n, k, q = 3e5 I think it will TLE or MLE.

    it will be O(1.5e8) pure time no constant factors

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

    For each distinct query, if you only check colors from the vertex whose set of colors has smaller size, I believe the total number of (query, color) pairs is bounded by $$$\max(n,q)\sqrt{n}$$$ or something of this form. After that you can use DSU to solve for each color, which barely passed for me.

»
7 months ago, hide # |
 
Vote: I like it -6 Vote: I do not like it

HI

»
7 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

I an Candidate Master, but why I am out of competition?

»
7 months ago, hide # |
 
Vote: I like it +1 Vote: I do not like it

It is the second competition on CodeForces that I have taken part in. Once again,I can only solve the first problem.

»
7 months ago, hide # |
 
Vote: I like it +97 Vote: I do not like it

Thanks for your efforts in making the contest! There's some room for improvements in the tests. A lot of people are passing D with code like this:

    for (int d = 1; d < n; d++) {
      for (int l = 1; l+d <= n; l++) {
        query(l, l+d);
      }
    }

(note that the correct solution looks similar but iterates over segments wrapping around the end). When $$$n=40$$$, $$$a=3$$$, and the working batteries are numbered $$$1$$$, $$$n/2$$$, and $$$n$$$, the number of queries is around $$$570$$$ versus a limit of $$$533$$$. I saw some submissions with this error during the contest but was disappointed to see that hacks are disabled for the problem. I think it would be instructive to have it as a test for upsolvers in the future.

For problem E, it seems like $$$O(tm)$$$ solutions are not intended to pass based on the constraints, but the constant factor is too low to punish it.

  • »
    »
    7 months ago, hide # ^ |
     
    Vote: I like it +5 Vote: I do not like it

    yes, u are right even i got accepted verdict on D using the incorrect logic you mentioned. I think they should just add a few cases and rejudge D

  • »
    »
    7 months ago, hide # ^ |
     
    Vote: I like it +1 Vote: I do not like it

    Yeah $$$O(tm)$$$ should be Blocked. But It passes Can there be a way to TLE these??

  • »
    »
    7 months ago, hide # ^ |
    Rev. 2  
    Vote: I like it +38 Vote: I do not like it

    I now wonder how the adaptive grader even works. In principal it should be able to run a test for some $$$n$$$, and at each $$$\lfloor n^2/a \rfloor$$$ it should check if the max independent set of the graph of queries is $$$\geq a$$$.

    This would mean there exists a way to place the batteries, such that you didn't find a good pair yet, while you already did the maximum allowed number of queries.

    • »
      »
      »
      7 months ago, hide # ^ |
       
      Vote: I like it +16 Vote: I do not like it

      The adaptive grader was coded like that, I used the kactl code for reference lol.

      I didn't make the tc tho. Funny enough, for our national olympiad I did the tc's and that same solution is the one that the national winner did and got WA ;-;

      I'm sorry for that :(

      • »
        »
        »
        »
        7 months ago, hide # ^ |
         
        Vote: I like it 0 Vote: I do not like it

        The tests make it seem like it isn't coded exactly like that; $$$a$$$ seems to be a part of the input instead of the grader trying all $$$a$$$ with a given $$$n$$$ at once.

»
7 months ago, hide # |
 
Vote: I like it +35 Vote: I do not like it

On A I thought matches were the same as iterations... and unfortunately the set of inputs that this gives a correct answer for is exactly the inputs given in the sample. Was so confused

»
7 months ago, hide # |
 
Vote: I like it -27 Vote: I do not like it

Hey, allow me to do the hack for D question please.

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

About problem D: during the contest I asked a clarification about whether the working batteries are fixed within the same test case, since the statement says "whether battery i (1≤i≤n) works is not fixed and may change during the interaction", but in the notes (say, the second) the working batteries are fixed (1,4,6 and 9 in that case). Judges replied "this is just an example for the sample test case, in the real judge, they can be shuffled after each query".

Since they can be shuffled after each query within the same test case, I understood that the result of a query has no relation at all with the result of previous queries in the same test case (except for the value of "a" and "n"). In fact, I could query, say, "1 2" and get 0 (no) as answer, and then just query "1 2" again and get 1 (yes) as answer, since the batteries were shuffled in between.

Given that, how to solve D without heavily depending on pure luck, since previous queries seems to have no userful information at all for the next ones?

  • »
    »
    7 months ago, hide # ^ |
     
    Vote: I like it +15 Vote: I do not like it

    If you've ever played "Evil Wordle", the concept is similar — the answer is not determined from the start but will never contradict a previous guess

  • »
    »
    7 months ago, hide # ^ |
     
    Vote: I like it +19 Vote: I do not like it

    The note in the statement about adaptive grading gives the answer to your question:

    However, it is guaranteed that there exists a configuration of $$$a$$$ working batteries that is consistent with the information that you have received so far.

    So this means that even though the grader can shuffle the batteries there's always some state of batteries consistent with all the queries until now.

    • »
      »
      »
      7 months ago, hide # ^ |
       
      Vote: I like it 0 Vote: I do not like it

      Does that mean that the interactor reads our inputs across tests and tries to avoid certain patterns in our queries? If that's the case, how do authors write such an interactor?

      • »
        »
        »
        »
        7 months ago, hide # ^ |
        Rev. 4  
        Vote: I like it +11 Vote: I do not like it

        What I'd assume it does is that it answers 0 to all of your queries until you ask all $$$\frac{n(n-1)}{2}$$$ pairs, and then, for all $$$a$$$ starting with $$$n$$$ and going down to $$$2$$$, once it reaches $$$\frac{n^2}{a}$$$ queries, it checks whether the maximal independent set of the graph whose edges are the queries you asked so far is $$$ \lt a$$$, and if it isn't then that means that there is an arrangement of batteries where your solution is incorrect so it gives you WA.

        Though, as some others have pointed out, there are some wrong solutions which still give AC; I don't know if it's because they did something different or if it's because there's a bug in the interactor.

  • »
    »
    7 months ago, hide # ^ |
     
    Vote: I like it +1 Vote: I do not like it

    The adaptive grader is just to counter randomized solutions, but that shouldn't affect deterministic solutions in any way.

»
7 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

How are O(t * m) solutions Passing for E.

Contest authors should design good test cases many O(m) are passing. Its bad

»
7 months ago, hide # |
 
Vote: I like it +30 Vote: I do not like it

Can somebody kick the codeforces servers? Some submission is staying in the queue and not letting system tests finish.

»
7 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Almost figured out everything possible for problem C

Spoiler
»
7 months ago, hide # |
Rev. 2  
Vote: I like it +3 Vote: I do not like it

luckily solved D in 8 minutes by intuition lol
i've got +150 rating boost and expert, but i'll probably loose it soon XD

»
7 months ago, hide # |
Rev. 2  
Vote: I like it +14 Vote: I do not like it

Tourist and code of many more individuals will fail for problem D. case : n = 40, good batteries: 1 14 27 40 (provided by karan_garg_12)

Those who did not consider pairs (i, (i+len)%n+1) for n — len <= i <= n will fail this case. Is there a way to include this case into system tests and re-run the submissions for problem D?

Below is tourist code which takes 403 queries for this case. Which is more than allowed(400).


#include "bits/stdc++.h" using namespace std; int32_t main () { int n=40; int q = 0; set<int>st; st.insert(1); st.insert(14); st.insert(27); st.insert(40); bool won = false; auto ask = [&] (int x, int y) -> void { if(won) return ; q++; won = st.count(x+1) and st.count(y+1); }; for (int len = 1; len < n; len++) { for (int i = 0; i < n - len; i++) { ask(i, i + len); } } cout<<q<<endl; }
»
7 months ago, hide # |
 
Vote: I like it +3 Vote: I do not like it

This round is rated to Div1? My rating was above 2100 before the round begin, and the beginning my handle was with a *, and when I registred, I think that I saw the messange of out bound, but my rating was recalculated, this occour with other people? Please someone can explain me, I got orange in the last round for the first time, sometimes I don't know the rules.

  • »
    »
    7 months ago, hide # ^ |
     
    Vote: I like it +7 Vote: I do not like it

    You registered as CM, then became master before round, but round still stays rated since you were rated for div2 at register time

»
7 months ago, hide # |
Rev. 2  
Vote: I like it 0 Vote: I do not like it
    cin>>n;
    set<pl> s;
    for(int i=2;i<=n;i++){
        for(j=1;i+j-1<=n;j+=i){
            for(k=j;k<i+j-1;k++){
                if(s.find({k,i+j-1}) == s.end()){
                    cout<<k<<" "<<i+j-1<<endl;    
                    s.insert({k,i+j-1});
                    ll val;
                    cin>>val;
                    if(val) return;
                }      
            }       
        }
    }

Should This Solution work theoretically as there are lot of discussions going on so just wanted to confirm my solution.

  • »
    »
    7 months ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    Theoretically this should not pass, but the interactor was weak and non-cyclic solutions (like this) pass

  • »
    »
    7 months ago, hide # ^ |
     
    Vote: I like it +5 Vote: I do not like it

    It's not too hard to test your solution by generating small inputs (like $$$n \le 20$$$) exhaustively.

    Your solution fails with this case: $$$n=11$$$, $$$a=3$$$, positions of working batteries: $$$\{ 1, 10, 11 \}$$$. The max number of allowed queries is $$$40$$$, but your program makes $$$41$$$ queries.

    BTW, it turns out my passed solution also fails with some inputs. Seems like the interactor is weak and many wrong submissions aren't caught.

»
7 months ago, hide # |
 
Vote: I like it +9 Vote: I do not like it

When is the editorial coming?

Excited for this one.

»
7 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

how can i get solution of problems

»
7 months ago, hide # |
 
Vote: I like it +16 Vote: I do not like it

I got some unexpected verdicts during hacking, could you look at it?

»
7 months ago, hide # |
 
Vote: I like it +7 Vote: I do not like it
»
7 months ago, hide # |
 
Vote: I like it +6 Vote: I do not like it

Hi Codeforces, I know I have low rating but I'll post my solution to C in case anyone will benefit from it:https://mirror.codeforces.com/contest/2155/submission/342138797

I wrote down my thought process in the comments.

»
7 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

solve C by classification discussion

Although the code is long, it works well

»
7 months ago, hide # |
 
Vote: I like it +2 Vote: I do not like it

Here is a clean brute force implementation for C

Spoiler
  • »
    »
    7 months ago, hide # ^ |
     
    Vote: I like it +3 Vote: I do not like it

    Thankyou — Really great solution — was struggling — it helps a lot :)

  • »
    »
    7 months ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    I had a similar solution where I try to create both the configurations, and check how many of the two are valid. The idea is that if there is a transition L -> L then the wizard seen count increases by 1, R -> R then decreases by 1, else it stays the same for transitions L -> R and R -> L. If abs(a[i] - a[i - 1]) > 1 then no valid configurations exist. Also, I only need to verify if the config is valid for a[n - 1] or not. If the config length is n then I know that it is valid for all a[0], a[1], ..., a[n - 2]. So, only a[n - 1] needs to be verified, which is easy.

    342166485

  • »
    »
    7 months ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    thx for the algo, had found conditions of <=2 answer and the adjacent same-different positions but couldn't code in time

»
7 months ago, hide # |
 
Vote: I like it +14 Vote: I do not like it

As an Olympiad participant, seeing problem C having you answer mod 676767677 is funny af, we didn't have that on the olympiad version of the problem.

»
7 months ago, hide # |
Rev. 3  
Vote: I like it +19 Vote: I do not like it

Okay, so for problem D, I couldn't get my head around querying for $$$(i, (i + d) \% n)$$$ (iterating over $$$d$$$) until we find a working pair (if anyone could explain it concretely with a proof it would be nice :).

I have solved it using a slightly different approach, say we divide the batteries into $$$\alpha$$$ sets, if we check for every possible pair in these sets, and we do not find any working pair of batteries, it is guaranteed that $$$a\leq \alpha$$$ (if $$$a \gt \alpha$$$, then we must have atleast one set with $$$2$$$ working batteries and we are bound to hit them).

Also, if the objects are evenly distributed the number of queries required will be $$$\alpha \times \binom{\frac{N}{\alpha}}{2} \leq \lfloor \frac{N^2}{\alpha} \rfloor$$$.

So now, I maintain a set of sets(containing pairs we have tested so far), at each iteration take two sets with the smallest size(say $$$p$$$ and $$$q$$$, smallest so as to maintain similar size between sets) and merge them in $$$p \times q$$$ operations(take all possible pairs such that one is from the first and other from the second set, this ensures that I do not query any pair that I have already encountered).

As the number of sets decreases, the upper bound for $$$a$$$ reduces by $$$1$$$ at each step(and we do not exceed the query limit), so we are bound to find a working pair.

This might be effectively(or I would say painfully ineffective) the same as querying for, $$$(i, (i + d) \% n)$$$, but I couldn't prove their equivalence, comments on this approach/proof would be nice.

Here is my submission 342162376 for reference.

  • »
    »
    7 months ago, hide # ^ |
     
    Vote: I like it +3 Vote: I do not like it

    Wow, this is a really cool approach

  • »
    »
    7 months ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    Could you please explain this part? How this inequality hold?

    Also, if the objects are evenly distributed the number of queries required will be α×((N/α)C2)≤⌊N/α⌋.

    According to my calculation: This inequality is only true when N/α≥2 AND N≤α+2. How this N≤α+2 condition will be true?

    • »
      »
      »
      7 months ago, hide # ^ |
       
      Vote: I like it 0 Vote: I do not like it

      You can expand the formula for $$$n \choose 2$$$ and see, for $$$\alpha$$$ sets, if the batteries are evenly distributed, then each set has $$$\frac{N}{\alpha}$$$, elements, expanding $$$\binom{\frac{N}{\alpha}}{2}$$$:

      $$$\alpha \times \frac{1}{2}\times \frac{N}{\alpha} \times \left( \frac{N}{\alpha} - 1 \right) \leq N \times \left( \frac{N}{\alpha} - 1 \right) \leq \frac{N^2}{\alpha}$$$

      Hope this clarifies your doubt.

»
7 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Can someone help me out: I dont understand where my submission for problem B is failing 342165930

»
7 months ago, hide # |
 
Vote: I like it +2 Vote: I do not like it

Is there going to be a editorial?

»
7 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Does anybody has a clean DP solution or can help me debug mine. Here is my code : 342080947

»
7 months ago, hide # |
 
Vote: I like it +5 Vote: I do not like it

In problem D, to comeover the issue mentioned in this comment you can increase the query limit to [n^2/a]+50. This is the safest way i think.

Even tourist did it the same way !

»
7 months ago, hide # |
 
Vote: I like it +2 Vote: I do not like it

24 hours after the contest and still no editorial!

»
7 months ago, hide # |
 
Vote: I like it +3 Vote: I do not like it

Will there be an editorial?

»
7 months ago, hide # |
 
Vote: I like it +1 Vote: I do not like it

I feel E is easier than C and D. I stuck on C for a long time. Should do E first.

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

editorial?

»
7 months ago, hide # |
 
Vote: I like it +1 Vote: I do not like it

When will the editorial be out , gotta upsolve the contest.

»
7 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Editorial still not available..

»
7 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Come on guys, please post the editorial, I am going through upsolving struggles.

»
7 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Please release editorials :(

»
7 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Hello team, Recently, I got a warning for problem B. I solved it completely on my own and can explain my approach if needed.I think this happened because of a similar approach or code structure.From next time, I will make sure to write code with a different template to avoid such coincidences.

»
7 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Hello, I received a message that my submission [342085810] for Problem 2155C coincides with another user’s solution. I want to clarify that I did not copy code from anyone. I discussed my approach with ChatGPT to refine my logic and implementation, which might have led to structural similarity with another submission. I now understand that using AI assistance during a live contest violates Codeforces rules, even unintentionally. I sincerely apologize for this and assure that I will write all future solutions completely on my own. Thank you for your understanding.

»
7 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

hey guys, maybe i need some help or advice, I really want to get good in problem solving not just because of this ratings or it might help in jobs or xyz reason . I just feel that i dont have good mathmatical mind but i want to improve it and be better at this as i feel valued and it feels good when doing codefoces as it forces me to come out my comfort zone.I need some advice how can i be more better in my problem solving skills?

»
7 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Dear Codeforces team,

I believe my solution was falsely flagged for plagiarism in this contest.

The problem in question had a very simple approach, and my code was written entirely by myself.
It’s possible that my solution looks similar to another participant’s because there were few natural ways to implement it.

Here is my code for reference:

342072853

I did not share or receive any code with anyone.
Please kindly reconsider this ban.

Thank you very much

»
7 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Hello, I received a plagiarism warning for my submission 342105427 for Problem 2155B.

I sincerely apologize for this mistake. I didn’t intend to violate the fair play policy, and I will make sure that this never happens again. In future contests, I will only use offline or private environments and will keep my code completely confidential.

Thank you for your understanding.