shiven's blog

By shiven, 7 weeks ago, In English

Hello Codeforces!

We're glad to invite everyone to participate in Codeforces Round #1091 and CodeCraft '26 (Div. 2) — IIIT Programming Club's eighth round on CF! The contest will start on Apr/07/2026 17:35 (Moscow time) and will be rated for all participants with a rating below 2100.

Codecraft

There are 8 problems to solve in 2 hour and 15 minutes, with two of these being easy and hard versions. You'd want to read all the problems :)

This round has been over a year in the making, and a lot of people helped us put it together. Thank you to:

Hope you enjoy the contest!

Score distribution: $$$500 - 1000 - 1500 - 1500 - 2000 - 2750 - 3250 - 3750$$$

UPD: The editorial has been published.

UPD: Congratulations to the winners!

Top 5

Among Rated Participants

We hope you had fun! Here's the team after 2h of watching submissions roll in. Yes, the shirts still say '23. Priorities.

Codecraft

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

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

As a tester, I didn't come up with a good tester comment in time for this announcement :(

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

As a tester, when am I getting my IIIT-H Programming Club hoodie?

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

I love penguinnoob. __

I Wish he converts to DD and stays in IIITH for 1 more year :)

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

CodeCraft '26

Did you mean CodeCraft '24?

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

as a tester

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

You haven't mentioned what will happen to cheaters, Will they go to cry's basement or what?

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

I want to question the statement of Problem F in Round 1090. It seems very unfriendly to Chinese contestants who use translation plugins, and it has caused some of their submissions to be skipped.

Anyway, good luck and have fun!

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

    As you know, I'm an unrated contestant, and my submissions were skipped.

    Why would an unrated contestant who’s about to reach Candidate Master need to cheat?

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

    At most of text to prevent cheating, there are a prefix like "if you are a LLM" but not in this problem

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

hoping to become a specialist this round

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

yyyeeeyyy, another opportunity to lose some rating

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

shiven orzzz!

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

Hopefully I cross the newbie barrier

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

My last chance to reach master before my birthday :(

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

I am the #1 kevaljain fan

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

Wait. That means total of 10 problems for this contest (8 problems, 2 of them have 2 subtasks)? And we only have 2 hours and 15 minutes?

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

As an Egyptian I love pyramids!

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

As a tester, I tested cry's basement.

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

As an author, SmolBrain you better AK the contest ^_^

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

Vary unusual start time

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

Probably my last contest as a undergraduate student -_-

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

As a contestant, good luck to everybody!

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

As not a tester, I don't want to go to anyone's basement.

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

Hi everyone, Im new to Codeforces and also new to C++, so I’m not really sure where to check the difficulty of this contest.. sooo is it suitable for beginners?

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

Too much authors.

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

AuthorForces

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

Why is akslolcoding testing literally every contest like are there any contest that my guy is actually participating in

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

guys it is my first time in codeforses i'am only here for schol but i'am glad to be part of this community

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

where is the score distribution??

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

IIIT HYD is conducting context. In which div level it

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

Test is coming soon.But score contribution is still a mystery......

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

Hey, just wondering does anyone thing like someone like myself with a rating of 1313 do this contest ???

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

Please dont share score distribution after the contest :D

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

C and F subtask??

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

how to be a tester?

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

Was the top of leaderboard banned? Stormed through the problems and vanished, LMAO

»
6 weeks ago, hide # |
 
Vote: I like it +51 Vote: I do not like it

$$$C$$$ and $$$D$$$ are so bad problems. Just guess, don't bother trying to come up with observations.

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

    Is there any proof of gcd in c? Or is it just observation

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

      YES that's a REALLY well known concept in mathematics, I can't comprehend why is everyone hating that question

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

        can you please tell me the topics or any resources to study to be able to know that proof

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

          Sorry I wasn't able to find any sources but here let me demonstrate myself:

          take a frog that jumps from a lily pad to another on a circle of N lily pads, jumping S steps to the right each time. As there aren't infinite lily pads one can see that it is required for the frog the step on a lily pad twice. Lets say that the first time the frog steps on a lily pad L for the second time, there was k steps between the first and second time it stepped there. Since we know that the frog took k steps to come back to where it started we might now conclude that the frog come backs to its current location every k steps as the lily pads are symmetrical, that is to say there are no difference between them, so coming back to one lily pad after k steps means k steps always makes the frog go back to initial position. and since a lily pad can't be visited twice before taking k steps we know that the frog has visited k different lily pads on total, and will ever visit them, as a loop started. So the question is: what is k equal to? There we have kS=0 (mod N) all leafs visited should mean that we have no kS=0 until k=N thus there should be no k such that k!=N and kS=0 mod N, if S and N had a common divisor d, we would have (N/d)S=0 mod N as S=ad for a random int a and (N/d)S=Na which does equal to 0 mod N. This question also requires showing that on the case that the only common divisor being 2, there are exactly two possible routes for the frog to go but using what I have already told, it should be easy to prove that yourself. (turns out the frog example was made up by our teacher so searching Frog Theorem as our hs teacher called it showed no results)

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

I created video editorial for D. Flip the Bit (Hard Version)

I also created video editorial for E. Definitely Larger

Problem F has 2 independent parts, one is Game Theory, and the second is Bit Manipulation / DP. I made a video editorial for the first part.

»
6 weeks ago, hide # |
 
Vote: I like it +106 Vote: I do not like it

SHIT ROUND

»
6 weeks ago, hide # |
 
Vote: I like it +46 Vote: I do not like it

guessforces

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

Why these problems reminded me of JEE

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

HUH?

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

For $$$C$$$, I just guessed if gcd(n, m) > 2 then no solution. And I assume $$$D$$$ has to do something with blocks of 0's and 1's.

»
6 weeks ago, hide # |
 
Vote: I like it +40 Vote: I do not like it

C should have been easier, i think and i don't know how there are more than 6k people who solved that, most of them must be cheaters

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

    Yes, rankings and ratings have no value now, and no CP authority seems to care enough to act*, so I guess competitive programming might just die slowly...

    *I don't count a cheaters database as acting, that is pretty useless. The incentive to cheat needs to be destroyed entirely (e.g. by not making rankings and ratings public).

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

    Well for me C was even easier than B honestly, the coprime finding algorithm is well known and after applying it to see if each row and column would get visited, applying it once again to see if each visits would coincide was also a really basic idea as well.

»
6 weeks ago, hide # |
 
Vote: I like it +22 Vote: I do not like it

D is much much harder than E. Still can't understand why there are so many ACs in D

»
6 weeks ago, hide # |
 
Vote: I like it +11 Vote: I do not like it

Feeling dumb after seeing submission count on C

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

F is a beautiful problem, but this round had some issues, for instance D is WAY harder than E and for C you just gotta guess and assume correct, i didn't get to solve G and H so i won't comment on those

»
6 weeks ago, hide # |
 
Vote: I like it -31 Vote: I do not like it

I really enjoyed C, thank you.

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

    can you prove it?

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

      It would be too tedious to write out a full proof, but here's a sketch for why $$$\gcd(n,m) =2$$$ works, but $$$\gcd(n,m) \gt 2$$$ doesn't work. (The rest of the problem is trivial).

      If $$$\gcd(n , a) = 1$$$ and $$$\gcd(m , b) = 1$$$ you can just pretend $$$a = 1, b = 1$$$.

      Maximum order of an element in $$$\mathbb{Z}_n \oplus \mathbb{Z}_m$$$ is $$$nm/\gcd(n,m)$$$. $$$(1,1)$$$ achieves this maximum.

      If $$$\gcd(n,m) \gt 1$$$, $$$(1,0) \notin \langle (1,1) \rangle$$$.

      The visited cells choosing to go right first are in $$$\langle (1,1) \rangle$$$ and $$$(1,0) + \langle (1,1) \rangle$$$. Both of these sets are of cardinality $$$nm/\gcd(n,m)$$$ (and distinct if $$$\gcd(n,m) \gt 1$$$), so the total number of visited cells is $$$2nm/\gcd(n,m)$$$. If all $$$nm$$$ cells are visited, then $$$\gcd(n,m) = 2$$$.

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

        if you're at $$$(0, 0)$$$ assume $$$0$$$ based indexing, lets discuss the necessary conditions.. all row indices must be visited independently -> $$$gcd(n, a) = 1$$$ similarly $$$gcd(m, b) = 1$$$ Now, no. of moves till it takes a circle and comes back to origin is $$$2 * lcm(n, m)$$$ And we should visit all atleast once..

        $$$2 * lcm(n, m) \gt = n * m$$$
        $$$= \gt gcd(n, m) \lt = 2 $$$

        These are the necessary and sufficient conditions

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

          Can you give some mathematical proof for the number of moves till it takes a circle and comes back to (0,0) being 2 * lcm(n, m) ?

          I'm unable to understand this part.

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

            We have n*m positions, and since all positions are symmetrical we can say that if it takes S steps to come back to a square after moving from it, than we have coming back to any square from it also takes S steps. Thus in those S steps we know that we have also visited S different positions. Lets define a step as moving left and down 1 step (as we can pretend a=b=1 now). Here at Sth step we are on (S mod n, S mod m). For it to make 0,0 we should have n|S and m|S, thus the first time we get back to 0,0 namely the amount of positions we visit becomes lcm(n,m) BUT we defined steps as moving left and down (or down and left) if we seperate those steps we see that we visit double the number of positions, thus comes 2*lcm(n,m)

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

Anyone How to Approach D ?

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

    You will need this problem as a prerequisite. Thanks to aryanc403 for showing me a beautiful proof of this in the past, I also created a video for proof

    Once you are done with the prerequisite, you can watch the edtiorial

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

    If you want a hint you should start by thinking about transition points within the binary array. They will come in pairs of two: one point where a "wrong" block of bits begins and one point where it ends. Since each operation has to contain one special index, you should think about splitting the array in blocks, like this: 1..p[1],p[1]+1...p[2] and so on. Take this as a starting point.

    If you can't solve the problem here is my submission, but please take the time to think about it, the problem is pretty cool. https://mirror.codeforces.com/contest/2217/submission/370145378

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

For C I observed that you can reach all values from 1 to n with a jumps only if gcd(n, a) == 1 and similarly for columns gcd(m, b) == 1. I thought that if you can reach all values separately than you can reach them together somehow after many jumps but I was wrong in the assumption. Anybody solved this, can you tell me what was the other necessary conditon?

»
6 weeks ago, hide # |
 
Vote: I like it +23 Vote: I do not like it

Whoever wrote D, I'll hunt you down (then I'll do nothing but tell you why)

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

Can anyone explain to me how to do C I'm so confused after spending an hour on it. I was just drawing random things and telling myself I can't simulate it because it's 10**9 and just trying to find something mathematical to use

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

How to simply prove the conclusion of Problem C?

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

    assume correct ♥️

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

    proof by accepted

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

    First, it is apparent that $$$(n, a)=1$$$ and $$$(m, b)=1$$$ must hold.

    Then, if $$$n$$$ and $$$a$$$ are coprime, and $$$P={1,2,...,n}$$$ is a permutation of $$$n$$$, then $$$aP={a, 2a, ..., na}\pmod n$$$ is also a permutation of $$$n$$$.

    So we can arrange the index(row and column) $$$[1,2,3,4,...]\to[1,1+a,1+2a,...]\pmod n$$$. In the new grid, the two moves transform into:

    • Jump 1 step right

    • Jump 1 step down

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

    Firstly, to visit all the rows, we need to visit the row after the current row we are standing on after a cycle is completed starting from the current row. That implies, gcd(n, a) = 1. Similarly, gcd(m, b) = 1 is the condition for visiting all the columns. Now, after a cycle (moves after which we return back to (1, 1)), all the cells must be visited. Otherwise, we can never visit all the cells. Let's count the number of moves required to complete a cycle.

    Number of moves to complete a cycle = 2 * lcm (n / gcd(n, a), m / gcd(m, b)) = 2 * lcm(m, n). Let's understand why 2 is multiplied here. We need lcm(n, m) moves to complete any one of the rounding (either row wise or column wise. It actually depends on the first move we choose). But, we have to round both row and column to get back to (1, 1). So, we need 2 * lcm(m, n) moves in total. Also, in a cycle, each move covers a unique cell. So, the number of cells covered in a cycle = 2 * lcm(m, n).

    To fulfill the condition, 2 * lcm(m, n) >= m * n -> gcd(m, n) <= 2.

    So, the answer will be "YES" iff gcd(a, n) = 1 and gcd(b, m) = 1 and gcd(m, n) <= 2.

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

    If gcd == 1, when you finish a full loop, you'll eventually arrive back at tile (1,1) but moving in a different direction (if your first move was right, you'll come back and move down, and vice versa) This triggers a second phase that fills in all the gaps

    If gcd == 2, when you finish a full wrap, your path shifts perfectly landing you right next door on a tile like (1,2) or (2,1)

    If gcd == 3 (or higher), the gap is too wide, the loop closes too early, and some tiles will never be reached

    This is what I understood

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

I used two pointers for B was that the easiest way?

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

    I did it by checking the bit flips on either side and taking the maximum...Maybe simpler than two pointers but depends on how you implemented 2 pointers...

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

    I checked for the number of consecutive substrings that need to be converted to the left and right of the special index, then min(count_strings_left, count_strings_right) + abs(count_strings_left — count_strings_right)*2, since for 1 sequence to the left and 1 sequence to the right, we need 2 more operations. The remaining imbalance of sequences needs 2 operations each (in whichever direction they are)

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

Feeling frustrated as a person who loves writing big codes, on B I got in on 6th try with 117 lines of code :(

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

Thanks for all the effort you put into creating this contest. Not a single problem in this set is boring, even though i did not manage to perform well in this contest. Better luck for me next time.

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

C broke my dream of coming back to expert rank

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

Just rename the platform to MathForces atp.

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

hardest problem C i've ever seen

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

Can we get the fastest solves for each problem , lol , by friend got it for D (he is shy) :)

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

Timmy1003 is a cheater, look at his H solution and other solutions. the amount of code and the style is different to A — D solution.

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

I was trying something like this in problem C There exists a number k[i][j] such that k[i][j] = i mod n k[i][j] = j mod m For all (i,j) in [0;n-1] cross [0;m-1] Can anyone extend this approach? Possibly simplify something using CRT?

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

In problem C, gcd(n , a) == 1 and gcd(m , b) == 1 these are obv necessary conditions. But how to prove gcd(n , m) <= 2?

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

    Your state will repeat itself after $$$\frac{2mn}{gcd(m,n)}$$$ jumps, thats why $$$gcd(m,n)$$$ must be not exceeding $$$2$$$.

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

    To visit every tile, the sum of two sets of landings (even steps and odd steps) must be at least the total size of room, easy to get

    $$$ \frac{n*m}{\gcd(n, m)} + \frac{n*m}{\gcd(n, m)} \gt = n*m $$$

    =>

    $$$ \frac{2}{\gcd(n, m)} \gt = 1$$$

    =>

    $$$ gcd(n, m) \lt = 2$$$
    • »
      »
      »
      6 weeks ago, hide # ^ |
       
      Vote: I like it 0 Vote: I do not like it

      still can't get it. suppose S[r] denotes the set of positions that even steps visit, and S[l] denotes the set of positions that odd steps visit. Shouldn't the condition be |S[r] ∪ S[l]| >= n * m ?

      gcd(n, m) <= 2 only guarantees |S[r]| + |S[l]| >= n * m.

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

    I imagined reordering the rows and columns so that every operation looks like one step right or one step down.

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

    You can use Bezout to prove it. You can work with 0 indexed because it is easier.

    Suppose you choose to add b k1 times(so now i is congruent to b*k1 mod n), now in order to have the same residue of i mod n, we should set k1 to k1+ k*n. Same thing applies for columns. Then we can just choose k1, k2 the number of times to add b to i and j respectively such that abs(k1-k2) = 2, then the condition of the problem obliges us to make abs(k1-k2)=0 or 1, in order to do that we should find x and y such that x*n + y*m = 1 or 2, which means that the gcd of n and m is <= 2

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

I think D>E, F, G.

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

how to prove in $$$C$$$ that $$$gcd(n,m)$$$ $$$\le$$$ $$$2$$$

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

    I am assuming you already understand why gcd(n,a) and gcd(m,b) are 1. Assuming these two are true, you can observe the following:

    • if the gcd of (n,a) is 1, then LCM(n,a) is n*a. this means that after travelling n*a squares the person will be at their initial position. each jump has height a, so n*a jumps takes n jumps and thus the vertical position of the person oscillates with time period n.

    • a similar line of reasoning can be used to deduce that the time period for the oscillation in the horizontal direction is m.

    assume for example it takes 8 jumps to get back to the origin vertically and 7 jumps horizontally. this means that we end up at the exact same initial position after 56 turns (with both jumps). thus, the most amount of unique squares we can visit is bounded by lcm(n,m). since each turn has one horizontal and one vertical jump, we can visit at most 2 * lcm(n,m) unique squares before returning to the origin.

    to cover the whole grid, the maximum amount of visitable unique squares must be equal to or greater than the number of squares in the grid. Thus 2*lcm(n,m) >= n*m. With a bit of algebra, this is identical to gcd(n,m) <= 2. (I used the lcm version of the condition in my solution anyway)

»
6 weeks ago, hide # |
Rev. 2  
Vote: I like it -17 Vote: I do not like it

Dont ever write a contest ever again

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

@Musa_82FaGm used AI for sure, look at the problem H, and other solutions, he used

if(!(cin >> xxx >> ) return; some solution cin >> xxx; directly. only GPT/Gemini would do defense IO in codeforces, and you can see the almost the main and coding style is different for each solutions. the top standing almost all ai. this is AIforces. mf

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

Problem C is beautiful.. Was a bit upset initially that it is some random guessing, but the solution is very elegant and is something that can be come up with.. Great!

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

IN PROBLEM B , 3 1 0 1 0 2 why the answer is 2 , when i can do [0,0,0] just in one operation?? can anyone explain please .

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

can anyone give me the valid mathematical cum logical proof for c gcd(n,m)<=2 i guessed it into the contest but searching for proof and not finding any , it will be really helpful

  • »
    »
    6 weeks ago, hide # ^ |
    Rev. 2  
    Vote: I like it +9 Vote: I do not like it

    For every x,y there is cycle with some length. Cycle length is also number of visited cells.

    When gcd(a,n)=gcd(b,m)=1, let:

    ka=0 mod n
    kb=0 mod m
    k>0
    

    Let l be min_k. If l%2 is 0, real length is lcm(n,m). If l%2 is 1, then if you started with horisontal step, now step will be vertical. Real length is 2lcm(n,m).

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

      the chances of 2 people replying in the span of 10 minutes after the question was hanging for 50 minutes already is low, but never zero, lol

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

    Assume $$$\gcd(a, n) = 1$$$ and $$$\gcd(b, m) = 1$$$, otherwise the answer is NO

    Suppose the steps were done simultaneously, then you add $$$(a, b)$$$ to your current coordinates. Can you reach the cell $$$(a, 0)$$$ (which would normally be achieved because of the alternations)? The coordinates have the form $$$(at, bt)$$$, so to reach $$$(a, 0)$$$ we must have $$$a \equiv_n at$$$ and $$$0 \equiv_m bt$$$, which means that $$$t \equiv_n 1$$$ and $$$m | t$$$, which is possible iff $$$\gcd(n, m) = 1$$$. Okay, but what about the case when $$$(a, 0)$$$ isn't reachable. Then $$$(2a, 0)$$$ must be reachable from $$$(0, 0)$$$ by moving in the direction $$$(a, b)$$$, since it cannot be achieved from $$$(a, 0)$$$ the same way. Again, we get that $$$t \equiv_n 2$$$ and $$$m | t$$$, which requires $$$\gcd(n, m) | 2$$$. And if you can reach those cells, it's not hard to show that all other cells are reachable as well

»
6 weeks ago, hide # |
 
Vote: I like it +5 Vote: I do not like it
»
6 weeks ago, hide # |
 
Vote: I like it +22 Vote: I do not like it

I couldn’t think of a worse round, thanks.

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

Why hasn't the rating been calculated yet? Is the contest still rated?

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

wow there are so many algorithm geniuses in a div.2 round where so many grandmasters (even lgm) are beaten by so-called [trusted participants] :)

»
6 weeks ago, hide # |
 
Vote: I like it +11 Vote: I do not like it

I hate C

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

Why isn't it rated for me? It says not rated in the rating chart but here they say it's rated. Im really confused.

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

Nice Contest!! btw how to become a tester in a contest?

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

Could you guys update rating before the heat death of the universe plz :3?

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

just to complain, i think problem authors and testers should really check the ambiguous or confusing expressions in your descriptions. last night i stuck at problem a for approximately half an hour and eventually gave it up. I mistakenly thought one could decrease multiple positions, because the "some" word in the description. i didnt realize it until just now i went through it again and found there was a "it". changing "some" to "a" would be much clearer for foreigners. i also recommend authors fix description in problem g. it is not said in the description that left and right son are taken differently, and the "labeled binary trees" would easily mislead the participants to count labeled trees(nodes labeled from 1 to n). these details should be clarified in descriptions rather than letting participants to find out by checking the examples. it would be my pleasure if you could accept these suggestions.

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

The first few questions of this competition were almost testing the luck of whether one could find the patterns. I think this competition is really terrible.

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

Is this round unrated?

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

Why hasn’t it been scored yet after 12 hours?

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

    Seems like the contest didn't get positive feedback from the participants, that's why lol

    But yeah that's the first time I've seen such a long time being taken to update ratings in a div. 2 round

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

why ratings are not given yet?

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

Me and my homies waiting for the ratings:

»
6 weeks ago, hide # |
Rev. 3  
Vote: I like it +9 Vote: I do not like it

Please calculate the rating!

I have wait it for 14hours.

Edit: Rating Updated, I got 2098 ?????!!

WTF ?!

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

Calculate the rating when! T_T

Hope not unrated.

Edit: +369 rating hooray! ^_^

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

Is the contest still rated because it is taking quite long now for a div 2 contest ratings to be updated?

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

test

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

I'm frustrated too with the delay in rating change announcement, but can you guys just stop bombing downvotes while waiting for rating results? Organizers really put a lot of effort into making this round.

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

Cool, finally rated.

But why did it take that long?

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

[deleted]

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

[deleted]

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

Easily the worst contest I participated in so far. That was so disappointing.

»
6 weeks ago, hide # |
 
Vote: I like it -28 Vote: I do not like it

Hello,

I received a notification regarding similarity between submissions for problem 2217B.

I want to clarify that both accounts mentioned are owned and used by me. The similarity occurred because I used the same approach on my own accounts.

I was not aware that participating with multiple accounts in the same contest violates Codeforces rules.

I understand this now and sincerely apologize for my mistake. I assure you that I will use only one account in future contests.

Thank you.

»
6 weeks ago, hide # |
 
Vote: I like it -32 Vote: I do not like it

Hello,

I recently received plagiarism warnings for problems 2217D and 2217F in this contest, and I was quite surprised and concerned about it.

I would like to sincerely clarify that I solved both problems completely on my own during the contest. I did not access or refer to any other participant’s code. I spent time thinking through the approach myself, mainly using XOR transformations and bitwise reasoning, which I understand can sometimes lead to similar implementations among participants.

It is a bit disheartening to see my submissions flagged, as I always try to follow the rules and compete fairly.

I understand that structural similarities can happen in such cases, and I respect the system in place. I kindly request you to review my submissions once again. I would be happy to explain my approach in more detail if needed.

Thank you for your time and consideration.

»
6 weeks ago, hide # |
Rev. 5  
Vote: I like it -29 Vote: I do not like it

Deleted

»
6 weeks ago, hide # |
Rev. 2  
Vote: I like it -30 Vote: I do not like it

Dear Codeforces,

I received a similarity flag on my submission 370158810 for problem 2217D, and I would like to clarify my situation.

I worked on this problem independently during the contest. Initially, I implemented a more direct approach by explicitly counting segments where elements differ from x.

My earlier submission: 370139065, 370145835

After that, I refined the same idea into a more concise implementation by transforming the array into a binary form and using a difference array (XOR) to track transitions between segments.

My later submission: 370158810

Both approaches are based on counting segments where a[i] != x, but implemented differently (explicit counting vs. transition tracking). I believe the similarity comes from using this common technique.

I did not copy any code from other participants. My submission history reflects my step-by-step development of the solution.

I respect the Codeforces rules and would never intentionally violate them.

Regarding the system warning, I want to clarify that I compiled and tested my code entirely locally. I did not use ideone.com or any public online compilers during the contest.

Thank you for your time and for maintaining a fair environment.

Sincerely, Sogni265

»
6 weeks ago, hide # |
 
Vote: I like it -28 Vote: I do not like it

Respectful Appeal: False Positive Plagiarism Flags on 2217B and 2217D (pulkitjaincs)

Hello Codeforces Team and Round Coordinators,

I am writing to respectfully request a manual review of the coincidence flags placed on my account (pulkitjaincs) for my submissions on Problem 2217B (370128856) and Problem 2217D (370152721).

I fully support the automated systems used to keep Codeforces fair, but I coded these solutions entirely independently in my local VS Code environment. Because both problems have straightforward optimal paths, the underlying logic aligns with other users. However, a manual look at the raw code reveals undeniable proof of independent creation:

Evidence for 2217D (Dynamic vs. Static Array Construction):

My Approach: I dynamically constructed my padded auxiliary array using .push_back() line-by-line (pExt.push_back(0);).

Flagged Users: Both Starrism0203 and BongCoder... used a completely different conceptual approach: pre-allocating a static vector of size k + 2 and using direct index assignment (P[i+1] = p[i]).

Loop Boundaries: My inner loop explicitly defines startGap and endGap with an inclusive boundary (<= endGap), whereas the others rely on different boundary logic and prefix increment operators (++i vs my g++).

Consistent Stylistic Evidence (Across Both Problems):

Bracing/Indentation: My local VS Code auto-formatter uses strict Allman style (opening braces { on entirely new lines). The other flagged users consistently use K&R style (braces on the same line).

Macros: I reflexively included using ll = long long; but stuck to standard int types. The other users forced heavy macros like #define int long long and used signed main(), which I did not use at all.

Naming Conventions: My variables (cL, cR, maxC, pExt) are distinct to my personal coding style.

I take the rules of this platform very seriously. I kindly request that a moderator review these specific, human-typed differences, as they strongly indicate my code was written from scratch.

Thank you for your time and hard work in maintaining the integrity of the platform.

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

C problem was very frustrating. I was trying to prove my approach but couldn't do so in the contest. Had to see the editorial.

If anyone has seen some similar problems to C, i would very much appreciate sharing them with me.

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

How many of the top 5 (rated) used chatgpt? Very interesting contest history for some of those participants...

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

All the best!!

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

Finally spec yay

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

D is trash

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

i got -61 was able to solve first problem only , dammm bad at cp

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

learned a lot from the contest

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

I just wanna say $$$D$$$ is the most retarded problem of all time.