
Hello Codeforces!
The series of Educational Rounds continues thanks to the support of the Neapolis University Pafos. They offer a BSc in Computer Science and AI with JetBrains Scholarships. Gain cutting-edge skills in AI and machine learning, preparing you for high-demand tech careers. Limited scholarships available — don't miss your chance to study in Europe for free!
Educational Codeforces Round 193 (Rated for Div. 2) will start on Aug/07/2026 17:35 (Moscow time).
This round will be rated for the participants with rating lower than 2100. It will be held on extended ICPC rules. The penalty for each incorrect submission until the submission with a full solution is 10 minutes. After the end of the contest, you will have 12 hours to hack any solution you want. You will have access to copy any solution and test it locally.
You will be given 6 problems and 2 hours to solve them.
The problems were proposed and prepared by Maxim FelixArg Novotochinov and me.
Huge thanks to Mike MikeMirzayanov Mirzayanov, the creator of Codeforces and Polygon — two great competitive programming platforms. Without them, the Educational Rounds would be impossible.
Also, big shoutout to round testers: awoo, Alenochka, pusheen_1024, savolay, yegor.l!
We wish you good luck in the contest!








Finally, another Educational Round! Perfect time to lose my hard-earned rating. :)
You have never losed your rating yet, what are you even talking about bro?
write comment by your own dont use ai for this alsoo :)
Lmaooooo
why?ABCD,1117->1344for me.
No testers?
Are my eyes having problems or we are having a bug with this contest that LGMs can register rated?
This round will be rated for the participants with rating lower than 2100. It will be held on extended ICPC rules. The penalty for each incorrect submission until the submission with a full solution is 10 minutes. After the end of the contest, you will have 12 hours to hack any solution you want. You will have access to copy any solution and test it locally.
nope
YEah bro, what the heck
I hope to solve problem C && D *_*
I hope to solve problem A and B too
I only hoped to solve problems A and B, but fortunately, I managed to solve problems C and D as well; however, it is a pity that I ran out of time to solve problem E.
Luckily, I was able to solve a, b, and c
Same goes for me!
I couldn't solve C and E
:(
Educational rounds are not that good since edu189.
No expectations.
True.
Agree
lets go! another contest!!
As a participant, I don't think I can perform well after staying up late to 4:30 a.m. to watch Date A Live last night:)
Good luck!
Hopefully this is the time to get in competition
How to Register
oh yeah it's very good that we have a lot of contests in short period of time but it will be good if all of them are standard!
Why is it asking me whether I want to participate rated or unrated? I'm 2120 and the cutoff is 2100.
trashiest B I've ever seen
Agreed
Is the trashiest because you couldnt solve it?
If it is so, I guess every F div2 is trash lol
dawg b is easy dude just chop the strings into pieces
ha? just some easy if else things
There is a spelling mistake in problem E. In the output column,"beautiful" gets misspelled as "beauitful"...
How was this game? I wasn't able to attend it because of something.
not so educational for me today...
why are GMs showing on the official leaderboard? i toggle between the unofficial and official and it doesn't change at all
"Rated for div.2" means, everyone will be shown in official standings, but only div.2 participants will be rated. If you only want to see rated participants, change the "Both divisions" to "Division 2" in the top right corner.
POV my friend list today:
Edit: I took this picture before Radson solved D lol
Comeback :shaka:
What rating predictor do you use? I'd like to try yours
C > D (
isn't it?
C > E( isn't it?
what?
wu~
C >>>>>>>>>>>> E
I still don't know how I passed C... I just used some weird greedy and it passed
D is not that easy Totally disagree
Are you a cheater???
what? i think that you can first draw a lot of points where you can arrive
okay, I just thought your tries were banned on te latest contests because of cheating
Oh that contest i use AI to check my cpp because i really tired and write a stupid one i think.i can't even pass the sample. I'm malding at thatm time and make a stupid mistake. Sorry
and then, looking at (1,0),(3,0),(6,0) etc. i write another p[oints like (2,4),which can be arrived by (0,1) -> (1,2) -> (2,4). (4,2) can be arrived by the similar way. So I guess that i can draw a function like y=-x+n(n+1)/2. It's easy to realize that thing,right?
I thought I am good at math but that problem showed me it is not so. Thank you for explanation, mate
Problem F?
Where am I going wrong on C? Submission. Please help.
I think you will replace your answer by a smaller num:(
Yep, it passed now. Fuck this problem.
Oh what a pity
only solved A and B, not bad :)
i worked through lots of math, but didnt get it, what was the solution?
i explained here
How many moves do you need?
try a few specific numbers to find it ( Binery search :) )
Once you find it, any stupid way will work
Actually just try every possible number of steps works (t=100 and maximum steps = 20000)
was it that easy?
nice pfp bro
First time using FFT in my life, it got 500 ACs on it tho
Seems it passes without FFT... why can't it be n^2?
UPD: Well, number of candidates will be sqrt(n)...
size of each group is $$$O(\sqrt n)$$$ because all integers are distinct and their sum is not greater than $$$n$$$, I guess
how does one prove this? couldnt get gpt to convince with some branching structure thingy..
Let d be the diameter and k be the number of candidates on one side of the center. If x_i is a candidate, there exists 2 diameters which share the first x_i edges from that side of the centre. For each candidate x_i, there are atleast 2 distinct paths which intersect at a node which is a distance of x_i away from one of the central nodes. The total number of edges of contributed from these paths is 2*(d-x_i)+x_i = 2d-x_i. Therefore the total number of edges in the tree is atleast 2kd-(sum of x_i). We want to maximize the sum of x_i to minimize our lower bound for the number of edges. x_i can be atmost d/2 and to maximize our sum be count down form d/2 to d/2-k-1 giving k(k-1)/2 + (k-1)*(d/2-k-1) which we can upper bound by k^2 + dk-(k-1)^2 = kd+2k. This means that the number of edges is atleast 2kd-kd-2k = kd-2k = k(d-2). We note that the number of candidates is less that the diameter i.e. d > k which means k(d-2) > k(k-2). Since the number of edges (n-1) is atleast k(d-2), we get n-1 >= k(d-2) > k(k-2) which can be approximated to n > k^2 i.e. k < sqrt(n). Doing this for both central nodes and computing all possible sum combinations gives sqrt(n)*sqrt(n) = n thus going through all the combinations results in a time complexity of O(n).
I cannot think any ideas to solve problem D. My friend told that i need to do some maths but i still couldnt figure out how to calculate the minimal position (p, q) of the result
to guess i think
lets say you will make x jumps in total. your first move will contribute to the corresponding axis x times, the second move x-1 times etc.. so now the problem actually becomes, divide the first x numbers into the two axis such that the distance is minimized. now you can also see that the sum of the numbers is x*(x+1)/2, lets call this sum. now we can notice that if the end position of the x axis is some value v, then the end position of the y axis is sum-v. so then we are looking for the minimum of the function (x-v)^2 + (y+v-sum)^2. we can find it's derivative in order to find the minimum, and with a bit of math you get that the minimum of the function is when v=(x-y+sum)/2. now whats left to do is just iterate up to 20000(because the problem states that the maximum amount of jumps is 20000, although you can also pretty easily calculate this), and then calculate the corresponding values. when you get to the answer you can construct the actual string pretty easily with a greedy approach
B=C=D tbh. if anything C is probably harder than D
I think B is easier than C & D, especially because people are solving B more than both of the other problems. I solved B in like 10 mins, but C took me over 1h to think and debug.
B < D < C, ranked by the time i used in each one
B < C < D, ranked by the time i used in each one
B<D<E<<<<<<<<C
B<E<D<<<C, E is quite easy with NTT, learned something new with that i guess.
Well, at least this round teaches me implementation skills.
how many people will be selected for next round
My code for problem B only passes the example tests :( code
*only passes example tests
o thank you
Your code fails on test:
Because you only check if theres a block of size >= 2 with a block of size 1 and next to it is a block with different modules. But what if next to the block with size 1 is nothing, because the block with size 1 is in position 0 or n — 1. You prevented this with setting a[n] = -1, but your code didnt check the first position if it is valid or not. Sorry for my bad English. 3 is the answer of that failed testcase btw
Pls drop some hint on how to solve problem B.
Define a segment in the array to be a continuous block of values, so an array like
[1,1,2,2,2,1,1]has 3 segments. Handle cases wheren <= 3as edge cases.For
n >= 4, determine if there is a single swap that can be made that can increase the segment count by 2. If this doesn't exist, try finding a swap that increases the segment count by 1. Otherwise swapping is unnecessary; then answer will ben - number of segments.It's crazy that over 500 users solve an NTT problem.
It's more crazy that the half of the top 20 users are rated users, and rank 41 — 60 include a bunch of gray and green users. A lot of people cheating here.
Can you give me a basic view of what NTT is and why over 500 users solve it is unusual?
NTT is the integer variation of FFT (https://cp-algorithms.com/algebra/fft.html) which is used here to ensure all results will be correct. From what I know FFT in general is a pretty complex algorithm and 500+ solves on a problem using this should not reasonably occur. That said I'm not entirely really sure how NTT is involved with Problem E...
obviously the middle edge is included in any diameter. from there u just look at the lengths the left half can contribute and the lengths the right half can contribute (correctly) then all unique pair sums are beautiful. without that sqrt(n) people have derived(i dont really understand it) bound u'd just think o(d)=o(n) valid lengths so o(n^2) pair checks but nlogn with ntt
NTT is not needed. Each set has at most sqrt(n) distinct numbers, so you can just do a sqrt(n)*sqrt(n) loop.
HATE EDU ROUNDS WITH GUESSING AND GUESSING B, C
i just skip them at this point XD
I would rather see Arsenal win the UCL than participate in this contest
For every step forward , I move 2 steps back . Really disappointing :(
Felt harder than yesterday's div-2
Have educational contests been getting harder? I'm still struggling with C, yet I'm able to solve past D problems.
I think B could be very better but A and C were good I prefer a balanced contest and I think the algorithm and theory part wasnt enough
can someone explain c ?
in your matrix, you can either have: n elements from X and m-1 from Y OR n-1 from X and m from Y. After you get that observation, you find a way of getting the highest sum of those elements where you can only sum each different number one time only.
My solution for C.
What is the maximum distinct numbers I can take from array a, array b and in total?
Is there any use to apply the operation on the same column twice with 2 different numbers (same for rows)?
What will the answer be if there is no common number between a and b?
What to do with the common numbers? Should I use it from a or b or both?
NOTE: I have swapped x, y with n, m in my explanation and code.
A key thing to note is that the ai and bi can go up to 2e5.
Constraints required are:
The maximum numbers I can use is x+y-1.
The maximum numbers I can use from array a is x.
The maximum numbers I can use from array b is y.
Now how to actually implement it?
Algo:
Init cx = 0, cy = 0, extra = 0, ans = 0
Iterate from the maximum element up to 1.
If the no. is not present in both a and b, I skip it
If it's present in both a and b, we store it in extra(basically saying that I could have taken it from array a or b) and add it into my ans.
If it's present in a, I will increment cx and also add the element to my ans.
If it's present in b, I will increment cy and also add the element to my ans.
Keep doing this while ensuring constraints are not violated
386118522
Ah I see, I was totally doing it wrong by mixing everything into one set. I thought taking the top n+m-1 from the union would just work, but obviously that ignored the per‑array capacity limits and also double‑counted common numbers. Using two separate sets and treating common numbers as "extra" before allocating them to either side is way cleaner — it actually respects the constraints and avoids the overlap issue. Got AC right after switching to that. Thanks!
Hard C, Easy DE...
Will there be an editorial for this?
Eventually.
My approach to D:
Notice that manhattan distance is invariant across all paths of equal length. For example among paths of with $$$3$$$ steps, we may end on any of $$$\{(0, 6), (1, 5), (2, 4), (3, 3), (4, 2), (5, 1), (6, 0)\}$$$.
You may also notice in the above example that we can reach ANY point with manhattan distance equal to $$$\frac{k(k+1)}{2}$$$ where $$$k$$$ is the number of steps taken.
After $$$k$$$ moves, we always have
because before the $$$i$$$-th jump we increase exactly one of $$$a,b$$$, so $$$a+b=i$$$ during that jump.
Now suppose we increase $$$a$$$ on move $$$i$$$. This increase contributes $$$1$$$ to the $$$x$$$-coordinate on every jump from $$$i$$$ through $$$k$$$, so its total contribution is
Thus the $$$k$$$ moves correspond exactly to the values $$$k,k-1,\ldots,1$$$: choosing $$$\texttt{X}$$$ assigns that value to $$$p$$$, while choosing $$$\texttt{Y}$$$ assigns it to $$$q$$$.
Therefore, to reach $$$(x,y)$$$ with
we only need a subset of $$${1,\ldots,k}$$$ summing to $$$x$$$; the remaining values automatically sum to $$$y$$$.
Such a subset always exists. Process $$$k,k-1,\ldots,1$$$ with $$$rem=x$$$. If $$$s\le rem$$$, subtract $$$s$$$ from $$$rem$$$. If $$$0 \lt rem \lt s$$$, take $$$rem$$$ as the final value, which is still available since all values below $$$s$$$ are unprocessed.
Visually, a given manhattan distance forms a "manhattan line" of reachable points with a slope of $$$-1$$$. We want furthest manhattan line with some part of it inside the rectangle $$$[0, x] \times [0, y]$$$.
One (albeit kinda dumb) way to do this is to check if $$$x + y$$$ (the manhattan distance of $$$(x, y)$$$) is a triangular number (i.e. can be expressed as $$$\frac{n(n + 1)}{2}$$$). If it is not, then try $$$x + y - 1$$$, if that fails, try $$$x + y - 2$$$ and so on. This will take at most $$$15,000$$$ or so iterations.
Once you find the nearest "manhattan line", simply check every point on that line that lies inside the rectangle, of which there are only about $$$15,000$$$ candidates. Alternatively, find the orthogonal projection of $$$(x,y)$$$ onto the manhattan line (not actually bad to implement).
rating update when
editorial where
Plz release tutorials soon.
BledDest can you release editorial pls
For B can somebody tell me whats wrong in my appraoch 386226955
I think in if(l1>=2) the if inside it is incorrect
C killed me. If I solved it quicker there was a chance I could have done E if I got that sqrt(n) derivation quick enough ;-;. This was still my best contest so far (by rank).
Nice
Hello Codeforces team,
I sincerely apologize for the violation. Both muhammadmiad and Ami-Miad are my own accounts, and I understand now that participating in contests using multiple accounts violates the Codeforces rules.
I did not intend to gain an unfair advantage over other participants, but I understand that using two accounts and submitting similar solutions is still a violation, regardless of my intention.
I take full responsibility for my mistake. I have now decided to use only one account for all future contests and will not participate in rated contests using any other account.
I respectfully request you to review my case once more and, if possible, consider restoring my rating/results or reducing the penalty. I understand that the final decision is entirely up to the Codeforces team.
I apologize for the mistake and assure you that it will not happen again.
Thank you for your time and consideration.
Hello Codeforces admins,
I am writing to appeal the rules violation that resulted in my submissions being skipped in Contest 2253 — Educational Codeforces Round 193 (Rated for Div. 2).
I received the following message:
"Your submissions in contest 2253 were skipped because of a rules violation in one or more submissions for problem 2253B — Hypercarp and the Control Panel."
As a result, all of my solved submissions in this contest (Problems A, B, and C) have been skipped.
I would like to respectfully ask for a manual review of my submissions.
I want to clearly state that I did not cheat in this contest. I wrote my solutions myself during the contest. I did not copy code from another participant, did not share my solutions with anyone, and did not use another participant's solution.
In particular, my submission for Problem B is available here:
https://codeforces.me/contest/2253/submission/386123531
This is my own code. I normally use a personal C++ template containing common macros and definitions such as "ll", "FOR", "all", "ckmax", "BOOST", etc. These are part of my usual coding template and were not copied from another contestant's submission.
I understand that Codeforces uses automated systems to detect suspicious similarities between submissions, and I fully respect the contest rules and the work of the admins. However, I believe that in this case the result may be a false positive.
I would therefore kindly ask the admins to manually review my submissions for Problems A, B, and C and reconsider the decision if there was no actual rules violation.
If my submission was flagged because of similarity with another solution, I would also appreciate knowing which part or which submission caused the violation, so that I can understand what happened and clarify it if necessary.
I am not asking for any special treatment. I only want my submissions to be reviewed fairly, because I genuinely did not copy or use another participant's code during the contest.
Thank you very much for your time and for reviewing my case.
Hello Codeforces admins,
I am writing to appeal the rules violation that resulted in my submissions being skipped in Contest 2253 — Educational Codeforces Round 193 (Rated for Div. 2).
I received the following message:
"Your submissions in contest 2253 were skipped because of a rules violation in one or more submissions for problem C. Sum of Distinct Values in a Matrix
As a result, all of my solved submissions in this contest (Problems A, B, and C) have been skipped.
I would like to respectfully ask for a manual review of my submissions.
I want to clearly state that I did not cheat in this contest. I wrote my solutions myself during the contest. I did not copy code from another participant, did not share my solutions with anyone, and did not use another participant's solution.
In particular, my submission for Problem C is available here:
This is my own code. I normally use a personal C++ template with standard settings I always use in contests, such as
#define int long long,ios::sync_with_stdio(false),cin.tie(nullptr), mx,vector usage, and straightforward loop structures. These are all part of my usual coding style and template, not copied from another contestant's submission.I understand that Codeforces uses automated systems to detect suspicious similarities between submissions, and I fully respect the contest rules and the work of the admins. However, I believe that in this case the result may be a false positive.
I would therefore kindly ask the admins to manually review my submissions for Problems A, B, and C and reconsider the decision if there was no actual rules violation. https://codeforces.me/contest/2253/submission/386128008 If my submission was flagged because of similarity with another solution, I would also appreciate knowing which part or which submission caused the violation, so that I can understand what happened and clarify it if necessary.
I am not asking for any special treatment. I only want my submissions to be reviewed fairly, because I genuinely did not copy or use another participant's code during the contest.
Thank you very much for your time and for reviewing my case.
Hello Codeforces admins, I am writing to appeal the rules violation that resulted in my submissions being skipped in Contest 2253 — Educational Codeforces Round 193 (Rated for Div. 2). account- Harsh_Negi_ I received the following message: "Your solution 386119386 for the problem 2253D significantly coincides with solutions" As a result, all of my solved submissions in this contest (Problems A, B, C and D) have been skipped. I would like to respectfully ask for a manual review of my submissions. I want to clearly state that I did not cheat in this contest. I wrote my solutions myself during the contest. I did not copy code from another participant, did not share my solutions with anyone, and did not use another participant's solution. In particular, my submission for Problem D is available here: https://github.com/Harsh-Negi-dev/Competitive-Programming-Practice/blame/main/Contest%2006%20August%202026/q4.cpp This is my own code. Also, one thing that I feel could be a reason was that I accidentally submitted my code on my github which I generally do after the contest gets over but that day I unknowingly and unintentionally did before the contest got over which you can even see with the timestamp over that repo. I normally use a personal C++ template with standard settings I always use in contests, such as #define int long long, ios::sync_with_stdio(false), cin.tie(nullptr), mx,vector usage, and rep and rev loop structures. These are all part of my usual coding style and template, not copied from another contestant's submission. I understand that Codeforces uses automated systems to detect suspicious similarities between submissions, and I fully respect the contest rules and the work of the admins. However, I believe that in this case the result may be a false positive. I would therefore kindly ask the admins to manually review my submissions for Problems A, B, C and D and reconsider the decision. If my submission was flagged because of the same reason, then please consider an apology and I will make sure not to submit my code publicly this way before the contest ends ever in future. I am not asking for any special treatment. I only want my submissions to be reviewed fairly, because I genuinely did not copy or use another participant's code during the contest. Thank you very much for your time and for reviewing my case. account- Harsh_Negi_
Hello. I lokeshkrcodes would like to request a manual review regarding the coincidence warnings on my submissions for 2253C and 2253D.
I wrote both solutions independently during the contest. I did not view or copy other participants' submissions, nor I shared my code with anyone.
I was surprised to receive the coincidence warnings and subsequently be placed out of competition. I am also currently unable to view the submissions of the other participants listed in the warning, so I cannot determine what specific similarities were detected or compare my code with theirs. I have attached screenshots showing this: drive link
I would appreciate a manual review of the detected similarities and my participation in the contest.
Thank you.
Dear Codeforces Coordinators and Admins,
My submission 386123227 for problem 2253D was skipped due to a coincidence with user Dominator_of_IITJ (submission 386125415). I am writing this to firmly appeal the verdict.
I wrote the code completely by myself locally on my IDE (Visual Studio Code). I did not use any online compilers like ideone and checked my code by CPH extension on VSC too, nor did I share my code with anyone.
The similarities between our submissions might come from the basic template setup (the library includes, using namespace, and the standard main function structure), which is a boilerplate I have been using by habit for a long time. You can easily verify this coding style by checking the past submissions on my account, ddminh2607.
As for the core logic of 2253D, the implementation was quite straightforward, which likely led to independent competitors coming up with nearly identical code structures.
Please kindly manually review my submission and the AST structure. I strictly follow the Codeforces rules and would never cheat. Thank you for your time!
Hello CF team
I participated in Educational Codeforces Round 193 and was recently flagged for a "rules violation" regarding Problem B. I want to affirm that the flagged submission was genuinely my own work.
My earlier incorrect submission was: https://codeforces.me/contest/2253/submission/386117290
The later submission was: https://codeforces.me/contest/2253/submission/386120900
During the contest, my local editor became unresponsive during compilation, so I quickly switched to my saved template file in the USACO online editor to rewrite and submit my code. The later submission resulted from debugging my earlier incorrect approach. I have also been a member of this platform for more than 2 years and I have consistently been practicing problems in the 1200–1500 range recently, so the performance was within the level I have been training at and the difficulty of this particular problem is only 1100 as well.
Please kindly look into this.