Hello, Codeforces!
IceBorworntat, NortGlG, omsincoconut, and I are excited to invite everyone to Codeforces Round 1071 (Div. 3), which will take place on Dec/23/2025 17:45 (Moscow time). You will be offered 8 problems, and you will be given 2 hours and 30 minutes to solve them.
Please note that this contest contains at least one interactive problem and at least one run-twice problem. Please read the guides for interactive problems and run-twice problems before the contest if you are unfamiliar with them.
The round will be hosted by the rules of educational rounds (extended ICPC). Thus, all solutions will be judged on preliminary tests during the round, and after the round, there will be a 12-hour phase of open hacks. After the open hack phase, all accepted solutions will be rejudged on successful hacks. Also, note that there is no score distribution—rank will be determined by number of problems solved, followed by penalty; wrong submissions will incur the usual penalty of 10 minutes, following the rules of educational rounds.
As a reminder, only trusted participants of the third division will be included in the official standings table. This is a compulsory measure for combating unsporting behavior. To qualify as a trusted participant of the third division, you must:
- take part in (and solve at least one problem in) at least five rated rounds
- and not have had a rating of 1900 or higher at any moment in time.
Regardless of whether you are a trusted participant of the third division or not, if your rating is less than 1600, then the round will be rated for you (unless you register unrated).
For Codeforces contests—including this one—improper use of artificial intelligence is severely condemned.
We would like to thank:
- sleepntsheep, Marszpace for their problem contributions and valuable help during the preparation of this contest.
- cry for great coordination and support throughout the preparation process.
- MikeMirzayanov for great Codeforces and Polygon platforms.
- temporary1, Friedrich, Intellegent, Argentum47, SpyrosAliv, catgirl, ritam1234, Proof_by_QED, ttamx, tin.le2, Ermiooo159, Mysticmage45, efishel, kwant, simplelife, macaquedev, chromate00, dazlersan1, ALnQ417 for testing the round.
- You for participating in the round.
- blackslex for no particular reason! Really, no reason!
We hope that you guys will enjoy the problems.








As a supposed tester, I'm fairly sure I didn't actually test this round! I appreciate the shoutout, however please double check whether I've actually tested it because for some reason I have a feeling I never actually did...
you should get your dementia checked
As a tester, I have amnesia!
You had a choice?
delayforces
As tester, i recommend read problem names carefully and slowly (Really)
If the name of the problem is relatively long and the statement of the problem is relatively short, I will like it and try to read the name slowly.
I will read them in O(n^n^n!)
Just try not to TLE :)
I bet the run twice is going to be interactive and placed >=E :)
You won
Good sense of humour human.
for real
it's my profile picture
In 23 december i will power on my sigma mode and will try to finally hack LonggVuz.
That sounds exciting :)
Since when you both became best friends=)))
XD
By the way, just being curious, what was your team's name at ICPC contests? I also had a team at HCMUS but couldn't qualify for the National contest as I was sick on the competition day. Hope I can do that next year.
I'm still in the team, it's PTIT.+-*/, u can find it in my profile :D
Completely unrelated — Is that Kaitou Kid in your pfp ?
Yeah, u r right :)
LonggVuz Please, stop typing strong codes. I tried for the first hour, but after I tried to test your code locally, your code responded to all "attacks" correctly. Add:
Then your code will be faster, and i will be happy :) (I'm just joking, don't add this)
I thinked that you will do E too, and wanted to hack him, but you don't X(
I will try until I succeed.
it shows random_number is not declared in this scope. what do i do then?
Random number you should select yourself.
i select your mom (respectfully as she's a sweet and nice person)
Sorry but bad joke (Or i don't understand English correct)
:(
oh nyo...:3
orz
interactive AND run-twice, orz
orz
orz blackslex
patience pfp spotted in the wild?
When will the score distribiution will be announced?
Its div 3 so there will be no scoredistribution, every problem gives the same amount of points (=ICPC style)
Thanks
EXCITED !
Hope to increase my ..... Wait, so I can only register unrated now? What a pity.....
I also want to experience this feeling of sadness one day :)
It is rated for less than 1900, so you can register as rated.
Maybe you have understood the blog wrong.
It says users lower than 1900 can register, and users lower than 1600 will be rated.
Anyway, thanks to your reply!
Ya, I misunderstood. My Bad.
mfw i'm in school for 90% of contests because they're in the afternoon and my entire high school goes 2nd shift, virtual contest it is for me i guess
Hope to increase my rating, and stay pupil.
As a tester, blackslex did not test.
Detestable
ginorz
ginorz
ginorz
now the 'You' button is working)
i hope i get 1000+
any tips? ive been trying for a long time now
just practice more
after seeing interactive one __what the heck!!!!
As a participant, I hope there won’t be any queueforces during the round.
As a participant I am really excited as this will be my contest after a long time..
As a participant best of the luck for this round to other participants!
As a spy, best of luck.
Looking forward to a great contest!
I hope to solve 7 problems in less than 2 hours and reach 1773 ^^.
You cant. As u are a expert. you must be lower than 1600 to be rated in a div3 contest.
yay that gonna be so cool, glhf bro!!!!
As a Human, We should drink more water.
As not a tester, can I become a tester? >:))
Yes, just become friends with authors.
I think many authors will accept more testers if contacted.
+1
i will finally get a rating :3
hope to have a good contest
Although many of my friends said being unrated looks better than being a newbie and it's impossible to reach pupil in just one contest, I still want to become rated. I'm gonna wake up at 6:30 tomorrow to compete.
My first ever contest! I am very happy to give it my best. Wish me luck :)
Can someone explain to me how does hacking work?
Hacking is more like finding flaws in other contestants’ submissions. You analyze the assumptions their solution might be making and try to break those assumptions by constructing a specific test case. If that test causes their code to fail ( WA, TLE, MLE, or RE), the hack is successful.
I hope it's not a Queue Forces again :)
Orz contest for sure! Sadly, I'm unrated this time, so wish everyone the best of luck.
spycoderyt can I see your yt
Hope to reach green again..
Before event:- Feeling exited and hoping to get 200+ :)
why is this delation
+
Maybe something that can prevent from queueforces. 💀
10 mins delay???
Yes
Should have informed that it is to be delayed by 10 mins !!
Why did the contest delayed 10 mins?
delayforces
Why 10 minutes delay?
why is the contest postponed.
orz
I thought that was a glitch after I saw the delay. T-T
Can anyone tell, Whats the reason for the delay of the contest is?
I could have my dinner if i would have known about the delay.. Anyways hoping for positive delta..Otherwise i will get L both ways
+
lol bro literally same me too
Best of luck, guys!!!. It's starting...., I am giving contest after a year
why Skipped me,I just use my own code,are u serious?
because you have the sign of cheating. Your submission is too fast among difficult problems.
who are u,u cant judge me
you shud be banned
u dont have a brain ,this is why u r still a expert
maybe I am less Intelligent but kind Sir can you teach me this
in your yesterday's G , no mediocre human would do this :)
If you have ever done some problems similar to those on earlier atcoders, you may know that if there are too many spaces at the end of a line, it will result in WA
If u are so intelligent , Y tf are they skipped mf ??
Not all judgments are absolutely correct, are they
WaForces
WhatDidIDoWrong???Forces
The contest felt more exhausting than challenging, I'm not sure that's the goal from the contests.
if you were getting a positive delta, would you still say this?
besides, how did you generalize the first two questions to the entire contest?
bruh , how was this exhausting ?? except for F all my solutions are extremely simple and small
E is pure guessforces
how did you do it..
and what is wrong with my submission:354832946
Guess some necessary conditions and pray that they are sufficient
I solved it with intervals intersection. I believe I can prove my approach.
Initially, imagine your intervals for X = [X,X] , and intervalForY = [Y,Y].
Now we process from left to right, for each index...
if s[i] == 0 then my interval ranges update to 1) [X,X] => [X-p[i], X-req(p[i])] , 2) [Y,Y] => [Y-(p[i]-req(p[i])), Y] ,
where, req(x) = (x & 1) ? (x+1)/2 : (x/2) + 1;
These two intervals are actually mirroring intervals. Best case for X, is worst case for Y. And range of these two intervals will always be same ( another useful observation to check final necessary condition ).
Nice communication problem
I have a communication problem now
Based on quality of the problems, I believe contest should have been announced rated for people under 1900. This seemed more like div 2.5 ( harder for div 3, easier for div 2). Excluding purples, this could have been good rated contest.
Thank you for amazing problem set.
Problem-E felt like more of (case work + guess work) with some stimulation, but overall the problemset was nice and interesting, thanks!
How do you do E?
Edit: F and G were very nice problems. I want to hug the people that made them
For corner cases of $$$problem-E$$$, I did stress testing, and for main logic part, if $$$s[i]==0$$$, means we have to give a ATLEAST OF $$$⌊p[i]/2⌋+1$$$ from "X", and vice-versa for $$$s[i]==1$$$ case (this is our lower-bound for the distribution). After that we will have some remaining "X" & remaining "Y" left with us after subtracting their lower bounds from them. Then we will just try to fill up the other halfs (lesser than part) which were left while filling the greater halfs in the first round, using these remaining "X" & "Y". Rest is just stimulation part, like we check if s[i]==0, then, does remaining-Y has $$$(p[i] - winnerPart)$$$ with it or not, if yes then continue further, else check if we can further increase "x" (winner part) to full-fill the criteria of $$$(a_i + b_i \gt = p_i)$$$, if this is also not possible then "NO" answer is possible, else move on to next index for further checks.
my submission : 354845447
This was my first contest on cf and it was too hard for me. I solved 0 problems and I'm so frustrated rn. Give me some tips how to improve?
just keep practice bro. you'll improve overtime. start with 800 rating problens first, and if you get stuck see the tutorial to understand how to do them.
But this has broken my confidence, now I feel that I cannot solve any problem.
tbh, this is normal. sometimes you do good, sometimes you do terribly. So yeah, dont push yourself too hard.
I think you should practice more
Read the tutorial after 20-30 minutes of thinking
i think i solved both B and D by a dumb way, but well, it worked
mathforces
Editorial: https://filebin.net/z7qkrvku7hp30f3w
E > F+G+H for me
H seems hard to implement to me, if I have the correct idea in mind
i am getting tle in H, the idea works
Passed H in 25min, figured out how G in another 20min, then keep getting WA on 6 until the end.
I'd really appreciate it if you could tell me the reason.
354821263
I think your solution fails to find the second corner for this matrix
Thank you. I passed it now.
Could you tell me what the logic is behind how you're calculating len? As far as I understand, it is the diagonal in which the corner you're trying to find is lying in.
Edit: If you are interested in an alternate approach, I would suggest using the first corner you found to find the diagonal in which the second corner lies
There're several cases:
When 1 is on the horizontal and vertical midlines, we can set len=mx
When 1 is at the corresponding corner to cur, find a random point ($$$\neq 1$$$ and $$$\neq$$$ cur) to ask max distance
If 1 isn't on the main diagonal, we have exactly mx-i+1 points and a corner with dis=i
If 1 is on the main diagonal we have exactly mx-i+1 points and 2 corners with dis=i
How to approach E?
an approach of discuss by cases code give WA (any counter-example for this code?)
appreciate any advice in advance
my code was failing for this case... check if that's also issue for you...
mine failed on
code outputs 'No'
expected 'Yes'
why expected 'Yes' though?
I believe this is one of the WHY's...
(5,4) , (2,1) , (2,1) , (1,0)
pair (x,y) represents, (type-x used, type-y used) in i'th configuration.
fk me, thanks now i see the problem
my code is nearly perfect, let me do a bit modification and try again
for
mine output 'No', did urs output 'yes'? the expected should be 'No'
for
output is "YES", you can simply arrange (2,1) setup
My code gives a YES for this test case. Thats correct, right? a={2},b={1}
https://mirror.codeforces.com/contest/2179/submission/354835368
I have tried several test cases yet I didn't find anything wrong :(
yeah, seems correct. you can brute run now. with any of accepted solution.
Ahh I found out where I was making a mistake, thanks
When can test case be shown? I re-submitted after contest but still only see sample test.
Now I see it
The problems were very unique and interesting, the problem C felt a bit tricky but in the end I was able to understand the tricky part and got accepted.
The problem D was definitely a good bitmasking problem, even though I got a WA on it.
Enjoyed the contest, and loved the problems.
wtf is E?
Why site is so slow?
Let $$$P=\sum p_i$$$. The answer is yes if and only if the following conditions hold:
I was doing something stupid for 2 and 3, thanks for the solution
Hello, can you tell me where my solution is failing?
https://mirror.codeforces.com/contest/2179/submission/354835368
Can someone help identify where it goes wrong
The contest was so good. I made some mistakes on D and E, which were blocks for me=))) And F was just so beautiful. I just wonder if F was so easy for an F? Maybe it could be D or E. I solved it with just simple BFS in 8 minutes, while spending nearly 2 hours on D and E (although that was mostly because of my mistakes). P/s: Thanks to the authors and testers for such a good contest at the end of the year.
I think you needed to know in a bipartite graph, if x,y are adjacent vertices, then we cannot have dist(v,x) = dist(v,y) because it forces an odd cycle. I'd say it's not an easy observation.
dahhhh seems to be using AI assistance during the round.
Check this submission for more verification: 354820979
I Left my PC open with in front of my friend and he thought : Oh he would be happpy if do "accepted" at E and this made me frustrated and thank god it didn't went accepted because i would never accept that and i would even disqualify myself and unregister from the contest . I'm sending my apologies to all Contest Makers and i can prove that i'm real in any way they like . Thank you !
you mean G right ?
Yes the one that i couldn't solve sadly :(((((
dog at my homework ass excuse. your multiple submissions contain comments so stop lying.
you are very clearly a cheater.
can you explain how you were struggling with problem B in Codeforces Round 1059 (Div. 3) on october 17th
and managed to solve 6/7 problems in Codeforces Round 1062 (Div. 4) on October 28th
Bro Look at your submissions history ! ahahahaha
Great contest!
Only I mistake vertex as edge on F???
+1
I didn't receive my rating till now I registered as rated but this contest is showing in the unrated section.
dw, rating will update soon. It shows unrated to everyone now.
In problem c test no 2,why not answer 5.
I assume you mean test no. 3. Because for test 2 any k> 3 will result in modulo 2 and 3. In test 3 if you take k = 6 then for the following values : 11 74 5 22 52 97 82 taking x as the following values will result in a[i] % x[i] = 5 for all, making the array equal :
6, 69, 6, 17, 47, 92, 77
orz for very good problems but I think my rating is cooked TwT
This was my second contest. Thanks blackslex!
in problem C, if a[1]=1, then souldn't the answer be a[2] (in the sorted array)?? edit- sorry, I made a silly mistake and confuses bw modding and dividing, gotcha
no, here's a counter example: 1 2 3 4 5 6 7
First let's sort the array and then approach the problem.
here, a[0]=1 and a[1]=2, so a[0] mod x>=2 is 1 only, but a[1] mod x>=a[1] is either 0 or 2, which is not equal.
That's why the best approach to solve this problem is to consider the the minimum element in the array, that way we can just mod every other element with themselves and get 0 and make every element equal eg: a[0]%a[0], a[1]%a[1], a[2]%a[2] , and so on.......
or make the modular residue equal to minimum element of the array for that we have to consider a number which is greater than the minimum element so that's why we subtract the minimum from the second minimum element from the array and see if we can get bigger number x. eg: max(a[0], a[1]-a[0])
because we have fixed the modular resdiue for the first element that's why we have to make sure that we can get the same modular residue from every other element by taking modulus of the element with some number greater than or equal to x. It can be proven that if we try to make the x more bigger it will ruin the previous modular residues.
why my score didn't increased yet ?
The round is still testing, you will also need to wait a little longer after system to get your rating
But it tests earlier than other Div 3, 4, Edu (usually at $$$9$$$:$$$00^\text{UTC+7}$$$ to finish). W round!
How long will it take to get the ratings?
i gave the contest , solved 3 problems but its shoeing unrated , i have rating of 400 , and i dont remember participating as unrated
Don't worry, it just says the contest is unrated for you because the rating haven't been updated. Just wait until the rating updates!
Hello,
I am not a trusted participant of the third division, but I registered rated and I can't see a rating change. Is it yet to be updated or will I not get any rating for solving one problem?
Just wait a moment.
Ratings have been updated
Saw it just now, thanks!
Really enjoyed upsolving G and H. Great contest!
Subject: Appeal for False Positive Plagiarism Detection on Problem 2179C
Dear MikeMirzayanov and Codeforces Coordinators,
I am writing to appeal the plagiarism flag on my submission 354734279 for Problem 2179C.
I firmly state that I solved this problem independently. The solution relies on a standard number theory observation. Because the logic is straightforward and the implementation requires very few lines of code, it is highly probable that independent solutions will have similar structures.
A coincidence in such a short and mathematical problem should not be considered a violation. I did not share my source code with anyone. Please review the submissions manually.
Thank you.
SpyroK05
Attention!
Your solution 354734279 for the problem 2179C significantly coincides with solutions SpyroK05/354734279, mishralikescats/354737233, thatsramen/354740445. Such a coincidence is a clear rules violation. Note that unintentional leakage is also a violation. For example, do not use ideone.com with the default settings (public access to your code). If you have conclusive evidence that a coincidence has occurred due to the use of a common source published before the competition, write a comment to post about the round with all the details. More information can be found at http://mirror.codeforces.com/blog/entry/8790. Such violation of the rules may be the reason for blocking your account or other penalties. In case of repeated violations, your account may be blocked.