
Привет, Codeforces!
Серия образовательных раундов продолжается благодаря поддержке программы Computer Science and Artificial Intelligence (CSAI) в Neapolis University Pafos со стипендиями от компании JetBrains.
В Mar/16/2026 17:35 (Moscow time) состоится Educational Codeforces Round 188 (Rated for Div. 2).
Этот раунд будет рейтинговым для участников с рейтингом менее 2100. Соревнование будет проводиться по немного расширенным правилам ICPC. Штраф за каждую неверную посылку до посылки, являющейся полным решением, равен 10 минутам. После окончания раунда будет период времени длительностью в 12 часов, в течение которого вы можете попробовать взломать абсолютно любое решение (в том числе свое). Причем исходный код будет предоставлен не только для чтения, но и для копирования.
Вам будет предложено 6-7 задач на 2 часа. Мы надеемся, что вам они покажутся интересными.
Задачи вместе со мной придумывали и готовили Адилбек adedalic Далабаев, Иван BledDest Андросов, Максим Neon Мещеряков, Роман Roms Глазов и Александр fcspartakm Фролов. Также большое спасибо Михаилу MikeMirzayanov Мирзаянову за системы Polygon и Codeforces.
Желаем удачи в раунде и успешных решений!
Наши друзья из Neapolis University Pafos хотят поделится с вами важной информацией:
CSAI: приближается первый срок подачи заявок — 28 апреля 2026 года.
Подайте заявку на программу бакалавриата по компьютерным наукам и искусственному интеллекту в Neapolis University Pafos. В этом году будет выделено до 40 полных стипендий, предоставляемых JetBrains Foundation.
Ключевые даты
- Крайний срок подачи заявки: 28 апреля 2026 года, 23:59 UTC
- Обязательный вступительный тест: 3 мая 2026 года
Отличная возможность: летняя школа подготовки ACTS 2026.2
Чтобы улучшить свои навыки и подготовиться к интенсивным программам, таким как CSAI, мы рекомендуем подать заявку на летнюю школу ACTS 2026.2 в Германии (10–20 июля 2026 года).
- Направления: Спортивное программирование (Competitive Programming) и Программная инженерия (Software Engineering)
- Крайний срок регистрации: 18 апреля.
Готовы развить свои навыки программирования? Присоединяйтесь к одному из ведущих сообществ в области компьютерных наук уже сегодня! Подайте заявку и посетите наш сайт, чтобы узнать все подробности.
UPD: Разбор опубликован









Auto comment: topic has been updated by chillingjellyfish (previous revision, new revision, compare).
Автокомментарий: текст был обновлен пользователем chillingjellyfish (предыдущая версия, новая версия, сравнить).
Hope I can become Master in this round :) (I failed last time)
UPD: Success!!
Good luck on it!
thank u ovo
How many years of competetive Programming?
good luck on it
Congrats
Not that 6 — 7 problems joke again...
Python: while True: print(67)
C++:
include
int main() { while (true) { std::cout << 67 << std::endl; } return 0; }
Java: public class ImprimirEternament { public static void main(String[] args) { while (true) { System.out.println(67); } } }
C:
include <stdio.h>
int main() { while (1) { printf("%d\n", 67); } return 0; }
Haskell: main :: IO () main = mapM_ print (repeat 67)
Assembly: section .data msg db '67', 10
section .text global _start
_start: mov rax, 1 mov rdi, 1 mov rsi, msg mov rdx, 3 syscall jmp _start
GLHF!
i shall get stomped like the goombah i am
Let's see how this goes!
Hope to don't lose my Specialist, please......
It seems you are going to lose it because you will become expert?
:smile:. Actually, I hadn't seen these tasks before, but the topics were familiar to me. And please, don't hack me. I'm too afraid of you :sob: XD
Good luck guys!
What is the difference between educational round and regular round other than scoring system? Is the problem "easier" and more "training" like than regular round?
The main difference is that Educational rounds use ICPC format (or the div 3 and div 4 format)
It felt weird seeing an actualtsg comment have nonnegative likes. Fixed that for you ♥ gl in the contest btw
Hope to reach 1700
congrats
i thought it was on russian till i saw that was translated
I absolutely HATE people who reply with "what". Seriously, are you a runtime error? A segfault in the human language compiler? Imagine spending your precious CPU cycles crafting a beautiful explanation, laying out your thoughts with the clarity of a competitive programmer optimizing their bitsets, and the only response you get is "what".
Like, excuse me, is your brain currently experiencing buffer overflow? Did you accidentally AND your listening skills with zero? Maybe if I rephrased this explanation as a Codeforces editorial starring your beloved bitset waifu, you'd suddenly comprehend everything. Honestly, next time someone hits me with a "what," I'll just reply, "Sorry, buddy, didn't know your attention span had a time complexity of O(1)."
Do better.
what
What?
waht?
what
I don't what like others
Why is the writer list on the contest page still empty so far
UPD: its ok now
what
What happen? A judge pause for at least 10 min.
Yeah, disappointed (queueforces argh).
Make it 20
Edit: A minute after writing this comment, the queue seemed to start up again.
it sucks
UPD: It is solved(aft 20 minutes).
InQforces ._.
Can any1 check the server pls??
Now! A judge pause for at least 30 min.
My submission was queued and got processed after 17 minutes and after 17 minutes I got to know I have submitted code for D in B problem. Queued again LOL
Is it just me, or does statement D kind of suck? (It’s written really unclearly)
true
Yes honestly, it took me so much time to understand the statement itself.
problem tells you: take a number, write its digits, add its digits, repeat until it becomes a single number… now arrange all the digits so the result of the magic game becomes some number..meh does that mean math or magic?nobody understands... but actually, nice contest, it's the first time problem D didn’t risk your rating.
Speedforces&Queueforces
the queue was way too long mid contest
time to train Lagrange multipliers, I forgor how they work
In problem D, for each component is it not enough to simply check if there's an odd length cycle? Iff not, add by x/2, where x is the number of nodes in the component.
No, imagine the star graph on m vertices. Then you want to orient edges from the outside to the center and the answer is $$$m - 1$$$. In short, for each bipartite component of $$$(x, y)$$$ vertices, you need to add $$$\max(x, y)$$$ to the answer
adding ceil(x/2) should work
consider the graph n = 5, m = 4
1 2
1 3
1 4
1 5
here the ans is 4
Dang it. So I should select the max of number of red vertices and number of black vertices in the component (iff it's bipartite).
How did so many people solved D?? was it so easy? Even after solving 3 problems(acd) my ranking is like 9k
D was just bipartite check.
yea but so many newbies solved it made me ques how is it so easy
Many newbies can solve a leetcode medium, it was standard, so makes sense ig
It's most likely really easy for even free AI models to do it so that would explain the high solve count, but yeah this was more like a div3 contest.
They use llms(mostly)
the dificult was understand the problem, the code is quite easy. Once you notice bipartite check, you code that in 2 minutes. But I have the same qustion with problem E
edit-> maiby IA notice the main idea of the problem, so the IA can solve it cause is not a hard code
There are sooo many cheaters. For instance, I am quite sure that sonsimpmiku cheated, who got every problems accepted in just 35 minutes. That's incredible.
Yeah if he is not an alt account for a LGM, then surely looks like he has, even maspy took 24 mins to solve G and this guy does in 8 mins
How to solve C..I tried but WA 367013755 here is my submission after contest... What i am doing wrong!
Actually, a * b * c / gcd(a, b, c) != lcm(a, b, c). Instead so, you can do this: lcm(a, b, c) = lcm(a, lcm(b, c))
ok thanx!
Your LCM function for 3 variables is wrong. Use lcm(a,lcm(b,c)) for 3 variables.
yeah understood :( thanx
i don't understand what even question 4 is saying .
I am depressed , it was my birthday today and I solved three in 25 mins saw 1k rank thought inflation would yield 2k rank but getting 5k at end has made my day bad... is D that easy , i was unable to even understand test cases
happy birthday!
happy birthday!
Same except the birthday part
Why is D's statement so unclear? I don't think problem statement language is supposed to be the bigger hurdle in a div2D.
Yes, poor statement for a good problem.
Problem E edge cases cooked me bad.
There should not be any edge cases for the problem if you ignore/handle strings of length 1 separately.
Yah my bad I thought "00001" something like this is allowed but only base case is "1","2",....,"9" . Again my bad for thinking S(x) can have leading 0 but since in x we remove leading 0 s(x) can't have it. So there can't be test cases like "0...01" or "10..0" as no vaid sol exist I think
can you tell me what am doing wrong if i just assume last digit as any number from 0 to 9 then propgate backwards ? the complexity will be 9*n? wouldnt it be?
plz help me finding flaw in my logic in problem C...
pnq should be lcm(p, q), and qnr, rnp, pnqnr as well, lcm stands for least common multiply
Screencast with commentary (once YouTube is done with processing it)
Preventing $$$O(n log$$$$$$2$$$$$$n)$$$ solutions in F feels unnecessary.
I agree (ignore my submissions, totally unbiased :( )
You cannot simply turn a forest graph into a general simple graph in the middle of the round :(
That's too critical to do so and I wonder how this had not been noticed before the round started.
If I remember correctly, english statement changed from "Call a vertex v beautiful if any paths" to "Call a vertex v beautiful if all paths" in the middle of the contest.
how do u do e?
Think what can be the max value of second number appended?
Try all possible 2nd number. Then try to generate the suffix sequence. The 1st number must be from the remaining digits.
*the maximum number that can be appended in the second round is : sum of the digits of string. *the minimum number that can be appended in the second round is : sum of the digits of string-100. *iterate over this range. now you know the number appended in second round, you can find number appended in subsequent rounds. since you have used these numbers, erase it from the string. now the remaining digits of string should be the number 'x'. check whether its sum equals the number appended in second round. if it is equal then you got the answer. *to reduce the time complexity, don't actually erase from the string. instead make a vector of size 10 which will store the frequency of each digits, and then subtract from the frequency when the digits are used.
check my impl for e it is pretty cool and different https://mirror.codeforces.com/contest/2204/submission/367015032
it works on the idea of brute force testing
For problem E: Today I learned that using
sscanf("str" -> "int") andsprintf("int" -> "str") to a short temporarybuffer_stringand do string manipulation is slow (TLE:367013757) on codeforces machine and better do manipulation on the integer directly: (AC:367016186)! Though that's not the case on my PC:weird x_x"
Here's what I found after some Google search:
Your local compiler might be using an extremely optimized version of sprintf for small strings, or it might have unrolled the loop differently. Online judges often use gcc -O2 or -O3 on Linux, which highly optimizes mathematical logic but can't do much to optimize external C library calls like sprintf.
I use clang compiler on my PC, so yeah that may be the cause. Maybe I should avoid using library call like
sscanfandsprintfnext time if possible(?)I don't think using it for string is a bad idea, but using arithmetic op on it might not be very efficient.
https://mirror.codeforces.com/profile/Ser_arthur Ser_arthur it looks is cheating , a newbie unrated who just joined and is in top guys in standing
felt like a div3
It looks like https://mirror.codeforces.com/profile/Ser_arthur Ser_arthur cheated, unrated guy who just joined some days ago is already in top standings !! and did all!! *
Pretty nice E and F, but imo E should be D and F should be E
for problem D is this sequence valid? 1 --> 2 <-- 3 --> 1 for test case 1 3 3 1 2 2 3 1 3
1 --> 2 <-- 3 --> 1 --> 2 would violate the constraints of the problem, so it is invalid.
No, cz one node can have all edge incoming or all outgoing. Also I don’t understand why susenyang is getting downvoted he is correct.
I find it interesting that 366982885 gets rte, but 367037092 passes. The only difference is allocating the large arrays on stack / heap. (Had to wait 20 min during the contest to find out)
Same thing happened with me on a onsite contest i couldn't figure out why. after the contest i found out vector<int> graph[n] was the culprit changing this to vector<vector<int> > graph(n) gave ac.after that day i never use 2d vector that way
For C++, the stack size is limited to 256MB, regardless of the memory limit of the problem (this number is hardcoded in the compiler command-line options).
You put the following things on stack:
int c[N][10], which takes ~38MB.vector<int> p[N*10], which takes ~228MB (becausesizeof(vector<int>)is 24).They are more than 256MB in total, so you have stack overflow.
Won't we talk about cheaters ? It is really frustrating, they affect the contest rating changes and this is not a fair play. I hope you do something about it
This time the tasks were easier than I thought.
felt like a div2
like a div3
YES bro, go +1
How to solve F? If we had only one k, then the greedy approach is to choose always one element in a subarray, more precisely element with smallest value of a[i], then decrease it until it becomes 1/1, then increase numerator. We can calculate for each element it's contribution. But how to solve this problem for many k's?
First, if you have 1/5, 2/5 it's better than 1/4. Then for many k's, if k[i] > a[j] — 2, the contribution is (k[i] — a[j] + 2), else, the contribution is (k[i] + 1) / a[j], you can iterate on values of k and precalculate the cum values of a with preffix sums
cum values :))
It seems my idea was incorrect. Thanks
Hello guyz!
man e was such an easy solution idk why i got stuck on attempting brute force as last digit assuming last digit can be anything from 1-9 and then proceeded backward propagation man fml
That was my thought process as well, I'll have to try and solve this again.
I really enjoyed the problem E :)
My thought process for Problem E is as follows :
The result number should have this form : x_sum_digit(x)_sum_digit(sum_digit(x))_ ... Let's call it v1_v2_v3_...
We can see that v2 <= max(|S|) * 9 = 1e5 * 9. => WE CAN BRUTE-FORCE the value of v2 !!! (Since the problem state that total of |S| in testcases <= 1e5)
I noticed that if we have the value of v2, we can construct v3, v4, ... all to the end.
And, after all of this, we obtain the total frequent of the digits in v2, v3, v4, ... and then use this to construct v1 (the original number — x) from what we have left.
For example, testcase 1 with the string "12735"
We brute force till v2 = 12 => construct v3 = sum_digit(v2) = 3 (since 3 <= 9 so we stop) At this point, the remaining digits are freq['7'] = 1 and freq['5'] = 1. We can easily check if the number 75 or 57 do the thing (here both answers are accepted, so i assume we select 75)
You only need to search
v2in this range:max(1, sum_digit(input)-70)<=v2<=sum_digit(input)and brute force the rest without pre-compute anything:Example Code: 367072645
The idea appear just now, before that I pre-compute all possible
v2in range:1<=v2<=999999and do reverse table lookup for all possiblev2givensum_digit(input):More complicated code (using larger than 110 MiB of memory): 367056743
Please check the hack https://mirror.codeforces.com/contest/2204/hacks/1170230
This hack is invalid because the number 11 does not belong to any S(x), while the test data has unexpectedly passed the validator's check.
Take a look please. awoo adedalic BledDest Neon Roms fcspartakm
We'll fix it as soon as Polygon is working again
Is the contest converted to unrated??
I think "unrated allowed" means that participants can choose between rated and unrated participation during registration.
If a participant selects rated, their performance will affect their rating [increase or decrease].
If a participant selects unrated, their rating will remain unchanged, regardless of performance [even if they solve no problems or get wrong answers].
cool
cool
has rating change happened
Not yet. I wonder why it's taking so long.
thank
Any hints on G?
Try to use dynamic programming (DP) to come up with a polynomial-time solution.
Try to use matrix optimization to reduce the time complexity to $$$O(m^6\log n)$$$.
Try to represent all intervals using prefix and suffix values, so as to optimize the matrix dimensions from $$$O(m^2)$$$ to $$$O(m)$$$. Now the time complexity is $$$O(m^3\log n)$$$.
Tks!
Why is the system test stuck at fifty-three percent?
As a fellow penguin I can assure you that the system is dead
Fortunately, it's recovered now.
awoo Can we have the editorial please.
is this unrated for all? in contests when i select rate it appears none, but in unrated this appears!
No, it happens because the ratings for the round are not updated. As soon as the ratings are updated it will appear in the rated section
Why the Ratings are still not updated yet ?
Yeah, one of the longest Edu round.
Nvm it got updated!
Yeah, finally.
☆*: .。. o(≧▽≦)o .。.:*☆
My submission for Problem D was flagged for similarity with a cluster of other solutions. I would like to state that I wrote this solution independently during the contest. The code uses a very standard bipartite coloring approach, and identifiers like col, ans, and cnt are common abbreviations that I regularly use in my own submissions. Because the solution is straightforward, I can understand how multiple independent implementations may end up looking similar. Nevertheless, I did not copy from any person, source, or publicly available code. I respectfully request a manual review, as I believe this is a false positive.
I received a message about solution 366974046 coinciding with others for problem 2204D. This problem is a standard bipartite coloring problem. The solution follows a common template that I have used before. I did not share my code, nor did I use a public IDE during the contest.I used VScode locally. The similarity is due to the problem being classic, not due to any violation. If needed, I can provide more details. Thank you.
Hii Codeforces Team I got a message from your side regarding my submission:367003879 for the problem 2204D. As I have studied Graphs from take U forward (Striver) channel on YouTube from this playlist https://www.youtube.com/playlist?list=PLgUwDviBIf0oE3gA41TKO2H5bHpPd7fzn. In whole playlist he has completed many different kind of question possible. And one of the question was on Bipartite graphs in this playlist which I have done earlier. And question 2204D was similar to that which is very standard type of question. I have written the whole code my myself and has not taken from any source. That's why I was able to do that question during the contest. I assure you that I am giving contests on Codeforces for a long time and have never violated any rule and will also not violate any rule in upcoming contests. So I kindly request you to review my submission manually and remove the warning from my submission. Regards
Hello Codeforces Team, my submission (ID: 366976578) for problem 2204D was flagged for similarity. I would like to clarify that I wrote the solution independently during the contest. The task is a standard bipartite graph check, which naturally leads to very similar implementations across participants. I was already familiar with this algorithm from common resources like GeeksforGeeks (https://www.geeksforgeeks.org/dsa/bipartite-graph/) and cp-algorithms (https://cp-algorithms.com/graph/bipartite-check.html. I believe this is a false positive and kindly request a manual review.
Hello,
I am writing regarding the notification about the coincidence of my solution for problem 2204E with other participants.
I want to clarify that I did not intentionally share my code. It appears that my younger brother accessed my computer while I was away and copied the source code without my permission. I realize now that leaving my workstation unlocked was a mistake on my part, even in a home environment.
I have already taken strict measures to ensure this never happens again, including locking my computer every time I step away. I value the community and the rules of Codeforces and ask you to consider this a one-time unintentional leak.
Thank you for your understanding.
this is actually your second skip, and the last one, was also from educational round. Also it's funny to see requests like 'my brother leaked my code, unskip please' or similar, do you want cheaters to defend themselves in this way too?
Bruh, i swear that my dumb brother made this..... And i don't understand why. He also expert, with cheating.........
he is expert? Like ibo1234 ? Or what his cheating id?
oh yeah, it was clearly ibo1234 because you both have skipped on that contest
UPD:
he is on read-only
Hello Codeforces team, I received a warning regarding my submission 366977261 for problem 2204D. I want to clarify that I did not copy code from any participant and did not use any public code-sharing platforms such as ideone. The idea I used is simply a bipartite graph check using BFS/DFS coloring, which is a standard approach and also appears in the well-known problem https://leetcode.com/problems/is-graph-bipartite/description/ (LeetCode 785) on LeetCode. Because this algorithm is very common, many implementations may look similar. I kindly request a manual review of my submission. Thank you.
Я получил уведомление о том, что я списывал задачи D и F у [user:Ityahanser]. Хочу заявить, что я действовал честно и не списывал.
Я никогда не нарушал правила раундов Codeforces, прошу пересмотреть решение.
Hello! I want to appeal my D and F submissions.
At first, the user that has similar solve is from China, probability that I know any chinese people are low because I'm Russian.
At second, I've been used offline CP editor (you can see it in my comments before every task).
At third: this is Educational round and in my submissions I've used very popular ideas, they may be similar to another people ideas and this wouldnt mean im cheating.
Please review my submission manually.
I received a message about my solution 366984844 coinciding with some others for problem 2204D. This problem is a standard bipartite coloring problem and is therefore expected to have similarities with other users (especially considering that there are common templates for bipartite coloring). I did not share my code, nor did I use a public IDE during the contest.I used Code Blocks locally. The similarity is likely due to the problem being classic, not due to violation. If needed, I can provide more details to support this claim. Kindly check ASAP