Ü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:
- satyam343 for their amazing coordination and for rejecting our bad ideas $$${\color{white}{\text{and several other problems too.}}}$$$
- peti1234 for their LGM opinion.
- Alexdat2000 for the Russian translations.
- N_z__, Error_Yuan, _istil, busamate, andrei_boaca, Dominater069, nifeshe for ruby testing
- Proof_by_QED, zsombor, Valaki2, lacito, Peti, zsmihaly, de_sousa, 18o3, SeptaCube, efishel, cry for amber testing.
- sangeraf, harshith_04, Morisz10, monadtransformer, MasterRayuga, dkg7888, JagguBandar for amethyst testing.
- SpyrosAliv, Non-origination, chromate00, jampm, beaten_by_ai, lordlorinc, Doraho, larush, dedsec_29 for sapphire testing.
- UVince for the only apatite testing.
- Albertstein for the only obsidian testing.
- MikeMirzayanov for the almighty Codeforces and Polygon platforms.
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:
Div. 2:








I hope that the problems are interesting and I everyone gets a positive delta , I reach Specialist !!!
yes !!
pupil !!
is it theoretically possible for everyone to get a positive delta?
umm no , it is entirely based on ranking merit
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
Codeforces contests are not 0 sum in delta
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.
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?
pupil!!!
Well done!
As a tester, I am glad to have been sapphire this time )
Interested! Just it would be fine if i don’t get wrong on first 3 problems.
for real
obsidian testing :orz:
It was a pleasure doing obsidian testing as my very first Codeforces round! And what a round!
Error-42 round orz
Error-42 orz
Hopefully the problems A-B-C are sorted difficulty wise unlike recent educational round
Frrrrr
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!
I have a question, how do people become testers?
SpyrosAliv is a goated tester :)
I hope for a round with interesting problems and no Newbies performing like Grandmasters...
fr
It seems that this round is related to gems. I need to quickly review the algorithms about gems and minerals.
As a banana tester, here is how we decide the score distribution:
As a doge tester, that's about as accurate as it gets.
Lol
Did the coordinator reject good problems too? (for anyone confused there is white text after
rejecting our bad ideas)I use dark mode so your comment confused me
and several other problems too
strong hungarian contest! glhf
Hoping for a good round.
this is so funny, so much ratism, they just wont let newbies talk
I hope to solve all problems (or at least 9 problems)
Hopefully , I don't get wrong on pretest 2
Ruby testing what is even that bruh obsidian testing too,GUYS ORZ
thanks for the contest will try to perform better
Why is there no emerald testing?
Bro how did you make it this far with that name
orz
Thank you for the beautiful problems.
Thank you satyam343 for rejecting their bad ideas.
satyam343 for their amazing coordination and for rejecting our bad ideas (and several other problems too.) missing line
good luck mates
Thank you for letting me test this amazing round, it was very fun!
Hoping for a good and Positive Delta!
I think I have reached a temporary bottleneck need to practice more often to reach Expert. Hope anyone can give me tips
Did anyone else also notice that.. "and several other problems too."?? XD
As a CF newbie, I hope to rated rising more, come on!
my first competition.hope to solve 1 problem?
As a tester, it's a nice round
hopefully the round i finally reach CM :sob:
hi from the future
I am very excited!
All the best to everyone who are attending this contest
i hope i reach expert for the first time after this contest!!!
yayyyyy
WHY I cannot paste code on phone?My computer is stuck and cannot login Codeforces.qwq
Ok finally entered successfully.Cloudflare is a nailong.
Do you know how tiring coding on phone is?
I hope I reach pupil in this contest
who can tell me ,as a beginner, where should I go to look at the explanations for the problem?
they will upload editorial in some time.
I lost my rank 1 :(
Is this contest rated or unrated?
rated
oh no .. I got the idea for problem D2 but couldn't code it ... aaaaa!!!!
How do you solve B?
I literally spent like 90 minutes on it.
same bro :(
I actually knew a trick which rotates the array
so if array is
abcde.. let me reverse first two and last 3 .. we getbaedc... now if you read this from a towards left .. you getabcde... so this is a rotation ofreverse of string... this way you can find all rotations using 2 operations for each row and you can achieveedcba( 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
i should not leave the first row untouch....
I think there might be other ways .. so I cant say for sure
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..
Alas,I was stuck on the same problem.
My intuition is to "shift" the original array, like:
It couldn't complete in 2 flip. Instead, we can get a "reversed and shift" array by 2 flip:
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; }} ~~~~~
Just how angry must a person be to make that kind of Problem B. B >>>>>>>> C :(
YEAH! MY FIRST DIV 2 CONTEST SOLVING 2 PROBLEMS IN A LONG TIME. THANK Y'ALL!!!!
THE B PROBLEMMMMMMMM
Any chance for py to pass D1 in O(qnk)?
same.. it passed pretest right ?
No... Got TLE at testcase 8
whoa !!! .. not sure why.
I passed it that way.
I also passed using C++ but somehow my python code still need to be optimized
I was going to submit on D2 and time finished 0.5 seconds before i submit
same but I needed few more minutes to test :(
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
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 :'(
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。:))))))
can you please share your solution?
https://mirror.codeforces.com/contest/2118/submission/324134778
I think it should be correct, except that I didn't flip the answer output
Basically, you try to fill the center square first, working from the inside out layer by layer, doing everything symmetrically
Then, you try to fill the sides, also opposite each other, and you will find that it seems easy to avoid more than 3 times
As for the center, you can fill it in at any time. For example, after the first operation
Ignore what I said, it actually needs a few more tweaks XD
I was 15 minutes away, seems like my minus delta is deserved.
Can someone help me figure out why I am getting TLE (Problem C) on https://mirror.codeforces.com/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
didn't see your code, but can you check if there is integer overflow as the problem have more than 32-bit numbers
I do have #define int long long int at front. Could it be because I did a>>1, a<<1 instead of a>>1LL, a<<1LL? :'(
yeah right... oh nooooo !!!!
yup lost 2 submissions because of this, always use 1LL (':
yes I have been there.. when your logic is correct but then MR OVERFLOW comes to ruin the party lmao. :( :(
(B)>>>>(D)>(C)>(A)
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 !! :)
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 .
Never trust examples, examples, from what ives seen are always misleading
Problem B demoralized me so badly,I left the contest halfway.
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 :,)
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.
Is there any easy to code for D1, i got stuck at dfs with memoization for 1 hours ToT.
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.
for D1 you don't need DFS ... you can simulate the whole process ...
but your solution might have solved D2 I think
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.
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
My luckiest contest
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
Yup i did the same.Just sorted using chess and manhattan from centre and tried my luck
Did that and got WA on test case 2 ;-;
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)
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
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...
see this .. you can do with two reverses
https://mirror.codeforces.com/blog/entry/143656?#comment-1282977
How are B and C the same score?
C is way too much easier than B
true C felt like 900-1000 kinda problem
yeah agree .... C implementation was also not very difficult.
Solved ACE but not B. Oh well.
Why this testcase gives YES in D ?
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.
Ok , thanks !
is it possible to simulate the entire process in D1? i tried doing DFS with directed edges but i couldnt implement it
yea I simulated it as I see that constraints were very small and it got AC
if only i had read C before B :(
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).
D1 was added to bridge the difficulty gap between C and D2.
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.
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.
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.
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.
yeah I do hope in future platforms have this feature inbuilt .... but out of platform it is very difficult to know who is cheating
So you are saying producing code with AI should be allowed in live contests?
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
what's a mogg
Am I the only one that found C super easy?
compared to B it was easy.
I found it the other way around lol. Did B in a couple mins but had to think carefully about C.
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
BI 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.
wow, cool to think like that in competition pressure.. I just cry and leave the contest :(
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.
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.
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 :(
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$$$?
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
CI also think so
i am so restarted solved only A
B killed me
My solution for problem C got accepted in pretest but somehow got skipped during main test, is this possible? do I need to report this ?
I even ran the same code in practice and it got accepted, but in ranking it is showing -1 for the question
never mind it got updated
Konsa ganja fuk ke Question banaya tha
Hyderabad Gate wala
XD
Are you gonna give ratings without showing the standings? Like suprise mf.
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.
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:
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.
i did the same lmao just to be safe i set that count to 1e4
B is kind of ad-hoc.C and D are quite GREAT problems!!!
I wasted my 90 minutes just to give up on D1
Good contest anyway, A, B, C was nice. B was a little bit tricky for me tho.
-orz-
Could someone explain problem B to me in a simpler way? I still don't quite understand it and what's the approach for solving problems like that?
see , if you try one thing is that a reverse of every row from 1 to n in two parts, guarantees a permuation for every col of the array , like 12345 first row reverse it full from 1 1 5 ,then row 2 , we do shift 2 1 1 and 2 2 5 , same with 3 3 1 2 and 3 3 5 and so on , any doubt ??
I just don't know if it's correct or not
umm try with a pen paper , mine was accepted
Construct an objective matrix whose first column is 1,2,3... n. The i-th column is the result of moving the (i — 1)-th column down by one cell.
Problem D1 is straight forward recursion, but couldn't code it out during context :(
Hi, I received a message about my solution (ID 323515523) for 2117E being similar to others. I wrote the solution myself, but it’s possible that some part matched with others because I referred to some materials online during practice and may have unintentionally followed a common pattern. I also used an online IDE to test my code, which might have made it accessible to others unintentionally. I didn’t share my code with anyone. I’ll be more careful in future contests. Thank you.
For div3 contest 1029 sorry for posting here
Dear Codeforces
I haven't "cheated" in a single contest. And still I am getting skipped for contests regularly this month. I have my intern season upcoming and these are the mails that I keep getting? And in this contest apparently I cheated from two different people? Bruh, they are my friends. That doesnt mean we are going to cheat.
This month, you are just putting allegations on me with any friend in my friend list and one was even unknown. I dont even know who the hell he is.
If my codeforces id, password has leaked, I am changing it right now. But I haven't cheated in a single contest.
You can see my profile. I am a trusted participant since 2023. My growth has never been too steep. I cant solve hard problems with ratings of 1800s or 1900s.
At last, I want to state it clearly that I have never cheated and I have a favour to ask that please don't suspend my account. My intern season is very nearby.
With respects Srijan Kumar
Can you bring the ratings rollback faster; please.
How on earth my solution for https://mirror.codeforces.com/problemset/problem/2118/E got skipped due to following plague:
Solution of user matching with me -: https://mirror.codeforces.com/contest/2118/submission/324093020
Mine solution -: https://mirror.codeforces.com/contest/2118/submission/324127586
It was a short and obvious solution without much logical implementation just a custom sorting applied and that is quite standard in JAVA(custom comparator sorting). Just the sorting logic and the custom class name(Cell) is same and this much coincidence resulted on both solutions getting skipped in fact the entire contest skipped on these basis.
Really unfair and unjust on such a platform, I know plagiarism and other checks are must but not at this cost of ruining someone's profile like this. This not only affected my rating but also my profile, dignity and image on this platform.
hello
For solution 324123859 of problem 2118C: I was warned for copying another solution. I did not copy code from anybody and came up with the solution myself by implementing a greedy bit-flip algorithm using cost-efficient bit increments (via __builtin_ctzll() and 2^bit operations). The solution is quite natural and optimal in the budget case, so identical solutions might emerge. I'd be glad to provide version history or local timestamps if necessary. Please take this explanation into account in your review. It would affect my rating.
Competitive Programming in 2025 – A Broken Race?
Two coders. Same leaderboard.
Result?
The problem: CP is turning into a “pay-to-win” model.
Impact:
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?