szilb's blog

By szilb, 15 months ago, In English

Üdv, Codeforces!

Error-42, gortomi and I are glad to invite everyone to participate in Codeforces Round 1030 (Div. 2), which will be held on Jun/12/2025 17:35 (Moscow time). You will be given 6 problems and 1 subtask with 2 hours to solve them.

The round will be rated for participants of Division 2 with a rating lower than 2100. Division 1 participants can participate unofficially.

All problems are authored by Error-42, gortomi and me.

We would like to thank:

We hope you will enjoy and have fun in the contest. Sok szerencsét!

UPD1: Score distribution: 500 — 1000 — 1000 — (1250 — 1000) — 2500 — 3500

UPD2: Thanks for participating, editorial is out!

UPD3: Congratulations to the winners!

Div. 1:

  1. tourist
  2. ksun48
  3. tiger2005
  4. maspy
  5. StarSilk

Div. 2:

  1. geniorzity
  2. KaiKaKa
  3. 2ky
  4. Bronya_H
  5. hondacity
  • Vote: I like it
  • +311
  • Vote: I do not like it

| Write comment?
»
15 months ago, hide # |
 
Vote: I like it +12 Vote: I do not like it

I hope that the problems are interesting and I everyone gets a positive delta , I reach Specialist !!!

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

    yes !!

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

    is it theoretically possible for everyone to get a positive delta?

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

      umm no , it is entirely based on ranking merit

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

      no. as far as I know the sum of rating of users is conserved in a contest so some will have to get a negative delta or otherwise everyone would get a +0 which in practice isn't possible

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

        Codeforces contests are not 0 sum in delta

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

        The sum of delta is a little bigger than 0. If not, the average of the rating of users will be fixed to 1400. but all users are developing.

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

          all users could be developing because new users are constantly being added., how do you know the average is still not x and why that x would be 1400? aren't new users come with a rating of 800?

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

As a tester, I am glad to have been sapphire this time )

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

Interested! Just it would be fine if i don’t get wrong on first 3 problems.

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

obsidian testing :orz:

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

It was a pleasure doing obsidian testing as my very first Codeforces round! And what a round!

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

Error-42 round orz

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

Hopefully the problems A-B-C are sorted difficulty wise unlike recent educational round

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

As a tester, I'm really happy seeing my name in the first place of the row. I wish "Kéz és lábtörést!" for everyone participating!

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

SpyrosAliv is a goated tester :)

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

I hope for a round with interesting problems and no Newbies performing like Grandmasters...

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

It seems that this round is related to gems. I need to quickly review the algorithms about gems and minerals.

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

As a banana tester, here is how we decide the score distribution:

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

Did the coordinator reject good problems too? (for anyone confused there is white text after rejecting our bad ideas)

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

strong hungarian contest! glhf

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

Hoping for a good round.

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

I hope to solve all problems (or at least 9 problems)

»
15 months ago, hide # |
 
Vote: I like it -22 Vote: I do not like it

Why is there no emerald testing?

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

Thank you for the beautiful problems.

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

satyam343 for their amazing coordination and for rejecting our bad ideas (and several other problems too.) missing line

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

Thank you for letting me test this amazing round, it was very fun!

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

Did anyone else also notice that.. "and several other problems too."?? XD

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

As a CF newbie, I hope to rated rising more, come on!

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

my first competition.hope to solve 1 problem?

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

As a tester, it's a nice round

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

hopefully the round i finally reach CM :sob:

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

i hope i reach expert for the first time after this contest!!!

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

WHY I cannot paste code on phone?My computer is stuck and cannot login Codeforces.qwq

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

I hope I reach pupil in this contest

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

who can tell me ,as a beginner, where should I go to look at the explanations for the problem?

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

I lost my rank 1 :(

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

Is this contest rated or unrated?

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

oh no .. I got the idea for problem D2 but couldn't code it ... aaaaa!!!!

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

How do you solve B?

I literally spent like 90 minutes on it.

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

    I actually knew a trick which rotates the array

    so if array is abcde .. let me reverse first two and last 3 .. we get baedc ... now if you read this from a towards left .. you getabcde ... so this is a rotation of reverse of string ... this way you can find all rotations using 2 operations for each row and you can achieve

    edcba ( 1 reverse whole string )

    aedcb (reverse 1 to 1 and then 2-5)

    baedc (reverse 1 to 2 and then 3-5)

    cbaed (reverse 1 to 3 and then 4-5)

    dcbae (reverse 1 to 4 and then 5-5)

    although reverse (1,1 ) and reverse (5,5) are redundant... they are allowed in the problem and don't increase the count above 2*n

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

    Follow this pattern

    1 1 n

    2 1 n-1

    2 n n

    3 1 n-2

    3 n-1 n

    4 1 n-3

    4 n-2 n

    and so on..

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

    something like that ~~~~~ void Solve() { int n; cin >> n; cout << 2 * n — 3 << endl;

    for (int i = 1; i <= n; i++)
    {
        int r1 = n - i + 1;
        if (r1 > 1)
            cout << i << " " << 1 << " " << r1 << endl;
        int l2 = n - i + 2;
        if (l2 < n)
            cout << i << " " << l2 << " " << n << endl;
    }

    } ~~~~~

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

Just how angry must a person be to make that kind of Problem B. B >>>>>>>> C :(

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

THE B PROBLEMMMMMMMM

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

Any chance for py to pass D1 in O(qnk)?

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

I was going to submit on D2 and time finished 0.5 seconds before i submit

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

    same but I needed few more minutes to test :(

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

      I solved the whole problem but was stuck on this very classical task for some reason

      given a directed graph and queries where a query asks you for a node

      just output "YES" if its in cycle and "NO" otherwise

      i solved it in the end but too late

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

        yeah me too.. but I needed more time to debug my solution as it was giving wrong answer near the end of the contest LOL :'(

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

I was only 1 second away from successfully submitting my E solution — when I moved my mouse over the submit button, the contest showed it was over

My mistake was: I swapped n and m, but didn't flip the output。:))))))

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

Can someone help me figure out why I am getting TLE (Problem C) on https://codeforces.me/contest/2118/submission/324135426. The time complexity is n(logk)^2

It seems to work whenever k is less than ~10^9. But n=1, a[0]=0, k=1e10 seems to break it :(.

Thanks

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

(B)>>>>(D)>(C)>(A)

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

    Well it's kinda like intuitive problem I guess. I followed my intuition and luckily it got accepted.

    I hope I can become pupil again after 609 days...!!

    Update: Bullseye. Finaly !! :)

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

      It didn't feel intuitive. The B problems are usually designed in such a way that the examples give away the algorithm. But these examples were totally misleading. Needing to reverse the first string and sacrificing an operation that way is a huge assumption to make .

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

        Never trust examples, examples, from what ives seen are always misleading

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

Problem B demoralized me so badly,I left the contest halfway.

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

    Same. I solved A in 1 minute, then spent 58 mins (!!) on B. Honestly skill issue on my end for overcomplicating it, but yeah :(

    Could've had such a good run today if I solved B like I usually do. C was quick and I had the idea for D pretty quickly but didn't have the time.

    Oh well, back to specialist I go :,)

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

      After spending too much time on Problem B, my brain just froze, and I ended up leaving the contest without even looking at the next problems. Definitely need to bounce back stronger in the next contest.

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

Is there any easy to code for D1, i got stuck at dfs with memoization for 1 hours ToT.

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

    Well, I defined state[i][j][b] to mean that we are currently at stoplight I, at time j mod k, and b is 0 or 1 indicating we are facing left or right. Then it’s just a matter of cycle detection from the first stoplight we hit. Let -1 indicate the state is unprocessed, 0 for under processing, 1 for having been processed and answer is no, and 2 for having been processed and answered is yes. That’s pretty much it.

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

    for D1 you don't need DFS ... you can simulate the whole process ...

    but your solution might have solved D2 I think

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

      My dfs is like dfs(int pos, int timer, int state) to know where is the traffic light we are in and the total time mod k and state is go left or right so how can I improve this to do D2.

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

        oh so for D2 the idea I came up with was ... you can draw and edge between i and j if pos[i] + d[i] MOD k was same for both... but you need to remember the direction of edge ... like i to j or j to i

        now with one DFS / BFS you can find out if a node is on a cycle ... then you can't escape if you meet a node

        I thought you were doing DFS like this

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

My luckiest contest

1030E.png

My E idea: First color the center, then color the outer circle of the center, and then color the outer circle of this outer circle,... For a circle, the closer it is to the four corners, the later the color should be.

Code: 324136762

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

    Yup i did the same.Just sorted using chess and manhattan from centre and tried my luck

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

      Did that and got WA on test case 2 ;-;

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

        checkout my last second submission, i defined comparator for chess than manhattan then x then y and took the distance from center (it was mentioned odd n,m so that was the motivation)

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

          Just realized my error was that I was solving recursively from rectangles inside rectangles ;-; (which lead to WA when the rectangle was not a square).

          Had I just sorted the points instead of adding a recursion on top of it I would get AC

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

I after reading B was intuitive to understand that it needed some left rotation logic that needs, to be done, but couldn't figure out the logic of left rotating within 2 operations, can someone tell me how to do it? Also, which type (tag) of problems on codeforces should I practice, to improve my intuition and logic for these kind of problems. Any help or suggestion would be appreciated...

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

How are B and C the same score?

C is way too much easier than B

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

Solved ACE but not B. Oh well.

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

Why this testcase gives YES in D ?

1
3 4
5 6 7
1 3 3
1
6
  • »
    »
    15 months ago, hide # ^ |
     
    Vote: I like it +3 Vote: I do not like it

    Lights on position 6 and 7 will be red on t = 3. During t = 0 you will be on position 6 and move to the right, for t = 1 you will be on position 7 and move to the right. Once you move to position 8 you can leave.

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

is it possible to simulate the entire process in D1? i tried doing DFS with directed edges but i couldnt implement it

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

if only i had read C before B :(

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

I don't think D1 is a proper problem that can exist in the contest. First, the solution of D1 and D2 are totally different. Secondly, D1 worths 1250 point so that solve D1 first can gain more score than solving D1 and D2 at the same time (maybe D1-500p, D2-1750/1500p would be better).

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

    D1 was added to bridge the difficulty gap between C and D2.

    First, the solution of D1 and D2 are totally different.

    I do not agree with this in general. It might be the case for your solutions. It is true that D1 does not require much thinking. But it is still a decent task for div 2 participants. That is why it was added. Sometimes, we do need to add some filler problems to balance the contest.

    maybe D1-500p, D2-1750/1500p would be better)

    In my opinion, D1 should definitely have more points than B and C. Yes, it could be argued that we should have had more points for D2. We were in fact thinking about having (1250 + 1250). But we did not do that. A lot of div 2 participants would be affected if we had low points for D1 (slow ABCD1 getting beaten by fast ABC). That is why we kept more points for D1 than B and C. We did not increase the points for D2, because we might need to increase the points of E too in that case (well, difficulty of D2 versus E is debatable). But that's the issue with subtasks, which are sometimes needed to bridge the difficulty curve.

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

      I agree, this contest has good balance, spent full 2 hours solving problems.

      Even though I didn't solve my last one in time I still feel fulfilled.

»
15 months ago, hide # |
 
Vote: I like it -19 Vote: I do not like it

Wasn't left with enough time to implement D2 so prompted GPT with the (not so well explained) idea and it gave a short and clean code. Didn't submit that, but wouldn't have been that hard to make edits and escape plag from other GPT generated codes.

I wonder if the AI guidelines could be relaxed when the prompt itself fully specifies the solution and implementation, as those only seem to serve as a compliance checklist for genuine competitors due to the system's inability to catch every violation.

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

    yeah I do hope in future platforms have this feature inbuilt .... but out of platform it is very difficult to know who is cheating

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

If anyone asks whether rainboy strategy is good:

I started today's contest on problem E (not even the last one). After almost one hour and WA on test case 2 I gave up and went to D. Solved D2 and D1 close to the end of the contest and still had some spare time left to solve C. Tried A without even reading the problem properly and that was it. Final result: ~ position 6000 (which is around 1330 performance, almost 800 below my rating).

So yeah, don't do rainboy strategy unless you mogg the contest you are doing

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

Am I the only one that found C super easy?

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

    compared to B it was easy.

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

      I found it the other way around lol. Did B in a couple mins but had to think carefully about C.

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

        whoa how did you do B .. and how did you come up with the operations ...

        I was able to solve only because I had seen how to rotate a string with reversal before... I think without that I would have suffered in B

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

          I knew that B was the type of problem where you can rabbit-hole and spend a lot of time on it if you try to build from the ground-up (speaking from experience lmao). So, looking at 2*n, I just thought of general, visually appealing patterns like partitioning each row into 2 segments and just incrementing the partition at each row. Checked on a few examples and it worked, so I knew inductively it should more or less work.

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

            wow, cool to think like that in competition pressure.. I just cry and leave the contest :(

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

          You would want a permutation in first column, for that you would reverse substrings starting at first pos and ending at increasing pos. After this the configuration of matrix we would have gives clear indication of what needs to be done from their on. Soln was observation on matrix of small sizes.

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

      Well I found it super easy in general. It was blatantly obvious to me that you first fill out the smallest missing bits. Just curious if someone else had the same experience.

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

        yeah that is true, but how to implement it so that you can accumulate all the lowest powers can be a bit tricky I think.

        I am just glad it was not a XOR question because then I cry :(

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

          How is it tricky. I just went through the numbers on a and added the costs for each missing bit into a vector. Then I just sorted the vector. Also, why was $$$n$$$ in C only $$$5000$$$?

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

            I did the same way but earlier I was thinking it was some complicated bit manipulation so I was a bit worried ... maybe I was overthinking as it was problem C

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

    I also think so

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

i am so restarted solved only A

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

B killed me

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

my jugaad solution for D1, simply simulated it- got tle/wa added a count-- variable on every rebound,played around some values and 1000 seems to work.

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

    So I use DFS to solve D1.Find a position with a light and a time to start,then see what happens the next light and so on.

    For example,input data:

    3 1000
    9 99 616
    819 0 0 1
    

    You choose to start at the second light at time 514,and it’s equal to start at the third light at time (514+616-99)%1000 = 31.Since it may change your facing direction,you should enumerate two directions.

    That will be O(n^2),available to solve D1 but not D2.

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

    i did the same lmao just to be safe i set that count to 1e4

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

B is kind of ad-hoc.C and D are quite GREAT problems!!!

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

Competitive Programming in 2025 – A Broken Race?

Two coders. Same leaderboard.

  1. One writes 200+ lines, fails test case #83, debugs, and finally ACs.
  2. The other pays ₹25 and submits instantly.

Result?

  1. Both rank above you. One earned it.
  2. The other bought it.

The problem: CP is turning into a “pay-to-win” model.

Impact:

  1. Honest coders feel demotivated
  2. Rankings lose meaning

The spirit of CP is at risk !!

The ask: Platforms like Codeforces, CodeChef, LeetCode must act fast. Cheating isn’t just breaking rules — it's breaking the community.

Let’s keep CP clean. Let’s keep it fair. Agree or disagree?