Hello, Codeforces!
We are very excited to invite you to participate in Codeforces Round 1130 (Div. 2) which will be held on Oct/26/2026 17:35 (Moscow time). You will be given 2 hours and 15 minutes to solve 7 problems.
The problems were prepared by yvbf, JerrySyr, MoScenix and me.
As yvbf always says, remember to eat well before and after the contest.
We would like to give special thanks to:
- Um_nik for the preliminary review of this contest.
- cry for the brilliant and great coordination.
- AksLolCoding, __baozii__, -firefly- for red testing.
- GUAIKATTO, More, 7_divided_by_3 for yellow testing.
- Edeeva, WorldWarV, yinruiyang for purple testing.
- Misaka16172, nik_exists, Yzm007 for blue testing.
- MORNING for cyan testing.
- MikeMirzayanov, KAN for the great platforms.
- Alexdat2000 for detailed Russian translation.
- TianTianChaoFangDe, tc_adventureking, MaxBlazeIceInk for providing problem ideas ( but declined :-/ ).
UPD1: Score distribution:
We are such a group of committed codeforces users. It's our first time to hold a formal round on codeforces, so we also hope you enjoy the problems!
Good luck and have fun!
UPD2: Congrats to the winners:
Unofficial:
1.peti1234
4.Lynkcat
5.maspy
Official:
3.Hienbeo
5.Velz
UPD3: Editorial is open:








Auto comment: topic has been updated by MaxBlazeIceInk (previous revision, new revision, compare).
As a participant, ████████████████████
████████████████████???
As a tester, MaxBlazeIceInk is cute and hope everyone have fun!
as a
As a tester, enjoy the problems xD
As a participant, I expect there's a cute milk frog in the statement
As a problem, I think the writers that the testers made are very good.
As a tester, I love MaxBlazeIceInk :D.
As a participant, I love MaxBlazeIceInk
As a participant, MaxBlazeIceInk orzzzzz!
7 problems div.2 is scary along with fun hope so :)
Wishing your (the authors) first formal round goes smoothly (^.^)
As a taster, I love MaxBlazeIceInk, who moved my name from purple testing to yellow in order to encourage me, which helped me acturally make it the exact day before this round. So, here is the love from More! (≧∇≦)ノ♡
As a still waiting unrated user, I want to say that "Another day, Another Div.2".
As a participant, I will make sure to enjoy
As a tester, I love MaxBlazeIceInk in d2 problem
As a participant, MaxBlazeIceInk is so cute
As a participant, I love MaxBlazeIceInk (。・ω・。)ノ♡
ノ♡(/・ω・/)
Please add more anime references to the problems
as a writer, i authored and it was too complicated
As an Isla, I love MaxBlazeIceInk. 嘻嘻小茵~
As a participant,I'm really looking forward to this yvbf round, and MaxBlazeIceInk is so cute.
As a participant,i wonder to know who is more powerful,MaxBlazeResFire or MaxBlazeIceInk?www
Wish I could participate but my bio exam is coming up T_T
i am not able to join this contest
wow such a cool contest!!!!!!
Speedforces again? The problems' score are lower than their usual ones.
As a participant, I meow meow.
As a participant, I wish you all good luck!
As a participant, MaxBlazeIceInk Orzzzzzzzzzzzzzzzzzz!
Hope to gain a lot of rating!
hope I'll become Candidate Master this round
kudos in advance!!
thx
Good luck dude
Hope to enjoy the problems!!
by LLMs?
can anyone enjoy the problems by doing LLMs??
you can....
Bro, just bcoz someone is doing better than you doesn't mean anything ...work on yourself , and think before saying something publically to anyone. hope you understand (you can compete 1v1 with me for your satisfaction)
sure bro....
1v1 of 3 hour accepted!
when should we duel??
and it is pretty clear that you cheated your way to pupil so obviously i cant trust you with a duel that u wont cheat, soooo we both will have to keep camera on and screenrecorder on too, then start solving.
marvyzy originally that cheater challenged u so do u wanna participate in duel too? dw i will make sure to add zco kind of problem too so your time doesnt get wasted
Unfortunately, I can't win against an llm... :sob: but it'd be fun to solve problems in a challenge!
unfortunately, i also can't win in giving proofs , think brother if someones told you to the same that you have , how you feel ..you don't know how much time i have given or things on my other platforms , maybe its just fun for you guys but it hurt when someone call you cheat. Although maybe you guys are pro coder you may solve better than me...still i accept the challenge.
mf just see ur submission and sybau
How can you guys even maybe not acquainted and attack each other? And all of you have no speciallist?!?!
Why to question a pupil?
Is it difficult to reach 1200 rating?
Why a high-rated user must be an AIer?
So every LGM is an LLM?
tf u mean?
Good luck yall, hope to get pupil on this contest
What the fuck?
Good luck next contest. Don't complain the organizer.
i am a beginer, maybe i am wrong, but the note of the question A (the second part of note) is wrong, i think so. sorry if i am wrong. but now i find this wrong.
yeah, i was wrong, sorry for the comment
Which problem setter thought it was a good idea to take the $$$k$$$-th $$$f_i$$$ from the end instead of the beginning???
Appeal for my account forking Round 1130 (Div. 2)
I think my account got banned in Round 1130 (Div 2) because of my submission timeline. I had fixed B earlier before solving C but, due to contest pressure, I forget to submit B. After solving C and D, I checked my submissions and realized I had missed B, so I submitted it and got AC. Then, 9 minutes later, E also got AC. I solved E in around 17 minutes and had already been working on it before that. I understand why the timeline might look unusual, but I hope it can be considered in context. I've been banned before, so why would I make the same mistake again, especially at the end? I genuinely solved these problems myself.
If you still think I have not followed guidelins, I am happy to have this contest made unrated for me, but please at least review my case once. I was getting closer to reaching my goal, and this happened. It really hurts to have my progress affected when I genuinely solved the problems myself. I just hope you can take another look at my case before making a final decision.
they did you dirty , you couldn't even cheat for a month without being noticed
Haha, I don’t need to cheat. I have enough experience and knowledge to solve everything myself.
I could get CM again soon with a new account, but I’d have to start everything from zero, and honestly, that really sucks.
Please bro, I've already suffered from my first ban on “daemonfork.” After that, I started playing legit, but sometimes things go wrong, and one bad day can ruin everything. You won’t understand how frustrating that feels unless you’ve been through it yourself.
I started solving B, got frustrated, and left the contest.
Oh my god Same, I left the contest after 1 hour because I got so mad.
One of the best contests I have ever given. Beautiful qs and first 2 were really nice ad-hoc problems
I did not know that I could hate a problem just like a person. Thanks, 2272B, for letting me know
wasted more than a hour on A to come and solve B in few minutes
Why is problem G so trivial????
B, D >>> E, F
I seriously do not understand how D has so many solves but F doesn't, when the latter is a really trivial application of rerooting.
What solution do you have for F? D is very simple if you know Konig's theorem, it makes the problem rather trivial.
First root the tree at node $$$1$$$, and do a DFS and compute $$$f(u)$$$, which indicates whether the current player wins or not when the game is in the following state:
It's easy to see that $$$f(u)$$$ is winning if and only if: $$$f(v)$$$ is losing for at least one child $$$v$$$, or the degree of $$$u$$$ is odd.
Since $$$f(u)$$$ depends only on its degree and $$$f(v)$$$ for children $$$v$$$, we can compute all $$$f(u)$$$ in $$$O(n)$$$ time using a DFS.
Note that $$$f(1)$$$ gives us the actual answer for node $$$1$$$. Then it's pretty simple to extend this to a rerooting solution and compute the answer for all roots.
the hardest part of D was input and output formatting
Really nice G, loved it a lot!
Great first three questions didn't understand what i was doing wrong in a, understood what to do in b and c but couldn't solve them also my mental is shit so after doing bad on a it was all downhill. On my way to newbie again :sob:
Also please if anyone would like to guide me how to get better please do so :D
I know I may have been banned because the submission times for my E and F problems were too close together, but I looked at problem F as soon as the contest started and had my first idea, and I dont think if i spend 30 min to solve E and forget to submit it will let me be a cheater.(because my shitly web) I have always write in my own coding style and kept my habits. I have already had one account banned for using AI at 2026 may, and I don't intend to repeat that, but I don't know why I was banned in this contest. Or maybe it was because of the b[i]==87 and m[0], n[0] in my E problem. I don't think AI would be stupid that to define an array like I did and then use only its first pos, or use ASCII to check a char ,also in my first submission for problem B have a stupid edge problem and my array size always X145141,also i use signed main ande #define int long long,
if U think im a cheater ,whatever you like,i just talk my situation,i can't change your thoughts,but i got improve,thats all
Problem A caused a headache; my brain froze after problem B.
Can someone please explain why this got wrong answer on pretest 2 (Problem C) 396164926
I can't solve it
Your idea of using binary search is correct, but the way you are checking the answer is wrong.For any two adjacent cells at max we can use 2 cells to color them.
Like which distances should be divided by k ? My greedy approach is wrong I guess , but how should I do it then?
You don't need to divide by k, if any two cells i and i+1 have distances less than or equal to mid,then we don't need one, if the distances between them is less than or equal to 2*mid, then we can use 1 one cell extra to color them. After checking and marking all of them, rest all unchecked can be colored using 1 cell extra for each cell.
Thank you
What I did its that i binary searched the answer , say you need to find if its possible to have the greatest distance between 2 cells as k, then before sort the cells you initially have,now maintain a set of the positions of all cells you currently have,when you are at cell i check if its possible for cells i-1 or i+1 to be sufficiently close abs(a[i]-a[i+1/i-1]) <= k one of them is ok, now if this condition is not satisfied add the cell of a[i] + k into the set so that cell i+1 has a higher chance of being close enough to the one you just added. this should work!
Thank you
I did not know that I could hate a problem just like a person. Thanks, 2272B, for letting me know
A visual example on C would really be appreciated, ngl. I wasted a lot of time trying to understand the question itself. Like the "choose an integer y such that 0 <= y < x, then select y cells" part, it sounds more formal sure but I think "choose up to x cells" also works?
contest is sht, my ratings dropped lower than ground
Somehow I managed to solve Problem B and not A, lol.
same
a-as a cute l-little tsundere~... blushes~ i-i.. I DONT KNOW OKAYY~?! HMPH~!
B >> D, F and G(if you have seen the trick)
i hate you.
the same, zoo
I'll never understand how can you make brilliant problem D into the worst problem because of the worst I/O format which completely differs from most of the other graph theory problems, is it really hard to serialize all the node ids into $$$[1, \sum n]$$$??
What's wrong with the current format? If we use your format then the node ids for the trees won't always start at $$$1$$$, which might be a less bit less intuitive if you view the graph as disjoint trees.
please help me bud :|
I agree with you, but there're some few questions:
forest[tree_id][u][ith], which is a 3-dimensional vector, using this is really a disaster. The solutions I can imagine to avoid this are just: merge the reading process and dealing process then only store the key datas for next process, orstruct Graph {...};to handle each components, neither of these really fits well actually.2 might be less important, the key question shall be on 1
3D vectors aren't particularly hard to deal with if you organize your code well, especially because for this problem you can process each tree individually.
Hard for me, at least.
Any newbie who got B is using ai or very lucky cos wtf is that question.
if you move up or down another frog can move down or up to take your previous row so you just need to see if the number of frogs is even if it's odd just subtract one to make it even , i can't see how this is harder than A
Overcomplicated it, cheers. For A my logic was the highest possible kth f value you can aim for is f(n-k+1). Therefore you just aim to maximise this by pulling the mex (located after n-k+1) of that subset back into the subset. you substitute it with the highest number above the mex in the prefix which maximises the possible mex
indexes might be off but i just checked what worked in my code lol
Yeah I think I was just not in the mood to solve it
aagreed, i looked at it this way 1. for a 2X2 block having 2/4 frogs, no frogs need to be removed 2. since every column has a frog, if there are even num of frogs, i can make groups of 2X2 blocks, which will always maintain the conditions in the q. if there are odd, u wont have a parter to complement the movement of the odd num of frog.
Strugged for more than a hour but finally solved it
after a point, i don't even know what's needed in problem A
The score distribution is so odd, and C and D seems not easy at the score(ESPECIALLY B==C???)... At least the round experience is not so good at least for me...
no way
your mom
Probably the worst contest I have taken in the last 2 years
The problem statements lacked clarity!
could someone please explain why my code for C doesn't work? (fails sample case 2)
i've been debugging it for almost an hour and it's driving me insane, idk if i've made an implementation error or my whole approach is off
}
thank you!
fucking hell im gonna crash out it turned out i accidentally did >=k instead of >k so it messed everything up
After thinking for half an hour I just guessed B and it got accepted.
I did not know I was going to war.
AB>CDE
contest was good ! But statement C was a bit off.. I mean... I kinda took what i wanted from it and the solved the problem :) And for problem A after trying to see if there is any special property.. I just bruteforced it :)
The test cases for problem B was questionable. For example, my submission got through test cases 2 and 3 somehow, just to get WA-d at test-4. The approach was wrong
D and F are very basic
What is the proof for $$$D$$$? I realized that the value for a tree is when we remove leaf nodes, then remove its parents, then leaf nodes again and so on. Like a topological sort.
So one possible way to join is to pick the parent of a leaf node in tree 1, and join node 1 of other trees to it. Do the procedure for tree 1, we get $$$val_1$$$, and now all the other trees get detached, and we do the procedure for each of them independently, so the final value would be the sum of $$$vals$$$.
Is this the maximum value we can achieve? Can't we achieve even better than this?
I got stuck in Problem B for a long time. I kept thinking the following grid requires removing two frogs, which wasn't right:
No removal is required. One of the possible jumping scheme is:
(Each arrow shows the direction of jumping.)
After a long struggle, I got it, and the final solution was stupidly short...
Yeah in each row, just pair the frogs. If both rows have even no of frogs, ans = 0. If one row has even and another odd, ans = 1. If both rows have odd no of frogs, pair them diagonally, like for $$$i$$$ from 1 to $$$n$$$ pair the frog in the current column with the next frog (which may be in the current column or in the next ahead column), and ans = 0.
Give me my rating!
I think the difficulty of problems was pretty far off from the scores
back to expert yay >w<! thanks authors!
The scoring might not have matched the difficulty of the problems that well, but honestly, this was one of the best algorithmic contests we've had in a while. It was nice to finally have problems that weren't just math-heavy or speed-based, unlike most recent contests.
I ranked 26
I'm confused on problem B. I had a much more complicated algorithm, and I think this test case requires k = 2.
1
6
fofofo
fooooo
in the top row, no matter where you move the two right frogs, it creates an imbalance. You can cancel one frog on the top with the bottom, but that still leaves two unsolvable frogs at the top. Can someone explain how k = 0 or 1 works with this test case?
The problem statement says "It is guaranteed that each column of the input grid contains at least one frog."
Ahh okay thank you, it makes sense now.
cry MaxBlazeIceInk MikeMirzayanov
Hello, My submissions in Contest 2272 (Codeforces Round 1130, Div. 2) were skipped due to a rules violation. I solved these problems completely on my own and did not use any external help, AI or shared code. Could you please let me know the basis for this decision, so that I can respond with the relevant details? Thank you, venkat2912
My previous account got banned and I accepted my fault, I never cheated after that. How can this happen now?
I have not done any cheating at all
cry MaxBlazeIceInk MikeMirzayanov
For reference, here are my three submissions from this round, with details showing they were written by me by hand:
396134354: it contains leftovers from my personal template (
import copyand asquareDigitfunction that is never used), commented-out debug prints (#print(alive),#print(mex)), a variable with a typo that is never used (kthLarget), and a simple O(n²) nested loop for the mex calculation.396153633: a five-line direct solution that counts the f/o mismatches and prints the count mod 2. For a problem this simple, many participants would naturally write almost identical code.
396184790: my usual coding style, with my own variable names (
toBeAdded,hookNode), the graph built with adictthe way I always do it, and inconsistent hand-typed spacing such as(i+1,1)alongside(i + 1, nodes[0]).All three follow the same personal style as the rest of my submission history. I would be grateful to know the specific basis for the decision.
Thank you, venkat2912