Привет, Codeforces!
Мы рады объявить, что Codeforces Round 1106 (Div. 2) пройдёт в 28.06.2026 17:35 (Московское время). Раунд будет рейтинговым для участников с рейтингом ниже $$$2100$$$. Вам будет предложено $$$6$$$ задач, на решение которых будет $$$2$$$ часа.
Все задачи были придуманы и подготовлены lewc, KotlechkovEgor и мной.
Мы выражаем ОГРОМНУЮ благодарность следующим людям, без которых раунд не смог бы состояться:
- 74TrAkToR за невероятную координацию.
- Um_nik и 244mhq за предварительное ревью раунда.
- zhiganov_v, wxhtzdy, JYJin, abc864197532 и OG_Matveychick1 за красное тестирование раунда.
- XaRDKoDblCH, pskobx, Mark_Pr и _LeMur_ за оранжевое тестирование раунда.
- _liravel_, mirach0ck, MaksimXD, AmirGG, VitaliiV, KluydQ и EduardoBrito за фиолетовое тестирование раунда.
- Yassia, FLYDEB, semwin2008, itz_pabloo, YF_YUSUF и kinoud за синее тестирование раунда.
- BoberVitalya228, grigalex40, Redk1tli и AdunAdunov за бирюзовое тестирование раунда.
- Ghuiko за зелёное тестирование раунда.
- awrt_xz за серое тестирование раунда.
- MikeMirzayanov и KAN за замечательные платформы Codeforces и Polygon.
- Вас за участие!
Распределение баллов будет следующим:
| A | B | C | D | E | F |
|---|---|---|---|---|---|
| $$$500$$$ | $$$750$$$ | $$$1250$$$ | $$$1500$$$ | $$$2250$$$ | $$$2750$$$ |
UPD: Разбор опубликован
UPD2: Поздравляем победителей!
Официальные участники
Неофициальные участники









same bro
New record: 12 contests in a row with no interactive problem. (Does not count 2237G - Send GCDs, because
it's too hard for me to solveit's also communication)Like round 1097, Problem D is below usual score.
This contest problem C > D.
UPD: just solution and code
Two consecutive rounds? Something happened?
(1105 & 1106)
Yeah, 8 days without rounds before it happened...
Actually it's two consecutive math rounds
Traktor is back in business.
As a tester, I really liked problemset, and since I'm a tester, please give me a contribution
May I ask that, how to become a contest tester please!
Back to back Div. 2's
hello i am beginner, i could solve no problem today, suggest me something to ace, i have 250 questions on leetcode. How to master codeforces ?
Do practice!
should we do topic wise practice or rating wise practice and secondly which topics are the most important.
you should do topic wise practice
Ok,Thanks alot
according to this blog, rating-wise practice is good since you'll encounter topics and learn them better based on their frequency instead of spending time on a specific topic that might not show up as often.
i felt b really tough, feeling so demotivated
wrong blog
omg 74TrAkToR round. Waiting at least $$$2$$$ NP complete problems and $$$1$$$ with incorrect model solution.
give me a cotribution edit1:how i get -46 votes ? lol =)
oh terrible gap between Div2D and Div2E.
As not a tester, I wish everyone +delta
... That impossible, because if you gain +delta, that means someone gained -delta. :(
That's why most wishes don't come true
As a tester, I really liked problemset, and since I'm a tester, please give me a contribution
wrong contest
Don't want to lose rating anymore TAT
Now Mr.Yin can register as this handle:)
Can you teach me how to get positive delta 13 times in a row :(
Tremendous effort and internet addiction, a collapsing GPA, and... a little bit of luck?
Btw, hope you can gain a ton of rating tonight, just like one user from your school who became Grandmaster last night:)
I've already told you, but last time I got downvoted.
The only thing left for us is to enjoy reading AI slop replies by this person under contest announcement blogs, who went from barely 1600 to GM-level performance in a month. It seems this person is the next tourist.
Is it NP-complete?
As an All_rounder, I carefully decided to start with Problem A. Peak strategy.
as a guy who decided to not test this round i hope it was a good decision.
UPD: also, as a friend i won't talk to Friendiks ever after unless I become master today
Wow such a big difficult gap.
why was yesterdays contest creators fixated on XOR!!
Same reason as why today the setters were fixated on GCD (number theory), as well as graphs! Overall, it was a great and balanced contest. Problem C is a great problem.
C < B imho
no what?
I hope this one isn't as hard as yesterday's. ~ fellow newbie
I hope to solve A to C (and maybe D)
How can I hack during the contest?
such a fun contest after a long time honestly
Loved the number theory problems $$$B$$$ and $$$D$$$.
Good problems, thanks for the round.
Love the themes for the questions!
One of the most beautiful contest I ever gave
Seriously, like the dopamine hit when I got D was like kisses.
This might just be my opinion, cause I love math more than coding.
Good problems
Love NumberTheoryForces!
Why to hell CodeForces website soooo non-responsive??? Submitting a solution often takes several minutes. mirror.codeforces.com is completly dead, m1/m2/m3.codeforeces.com are also dead. Failed to submit E on last minutes :(
problem D best(as a math lover). but esay.
Best div2 in a while imo
Great contest, reached CM. Lets gooooo
How it feels knowing that you can throw this round and suffer no consequences
And then proceed to get ABCDE and think I do amazing and then see perf of 2070 :sob:
problem D best(as a math lover). but esay.
Wow fast system test :)
In problem C,
"The houses in the village are connected by bidirectional paths"
So, if the graph is 1---2---3 then houses 1 and 3 forms a guild, right? (v=2;h=1)
{3} is guild, not {1, 3}
No, the problem specifies "houses in the subtree".
Carefully check the problem description again, and you'll see that a guild only contains nodes in the subtree of node $$$v$$$, which means the guild is $$$3$$$ instead of $$$1,3$$$.
I understand that from the picture but since the graph is bidirectional, we have no sense of direction
So, when we build a subtree with h=1;v=2 how can we include 3 but exclude 1?
Check the description again, the tree is rooted at $$$1$$$.
Since the graph is bidirectional, it will have atleast 1 loop (assuming $$$n \ge 2$$$)
So, if we define a tree with root 1, it's contradictory (as loops not allowed in tree)
EDIT: nvm, just realised that "bidirectional paths" is part of storyline and has nothing to do with the problem itself...
its a tree !
only the children of a node can form a guild.
ancestors can not.
problem D best(as a math lover). but esay.
I submitted F at 01:58:55, 65 seconds before the contest ended, and it got an AC a minute after the contest ended :)
oh yes Mathforces and Guessforces
and also bitforces(yesterday's round)
bro what, c was tree dp
Why did nobody hack?
Is it unhackable?
What is the solution to problem E?
E is just pure DP. Consider $$$dp_{k,i,j}$$$ means the maximum number of the minimum wrong answers in $$$[1,k]$$$ among all
Fsegments $$$[l,k]$$$ where the minimum wrong answers in $$$[1,k]$$$ among allFsegments $$$[l,r]$$$ is $$$i$$$ and the actual number ofF's in $$$[1,k]$$$ is $$$j$$$.F, we have $$$dp_{k,i,j} \to dp_{k+1,\min(i+1,dp_{k,i,j}),j+1}$$$;T, we have $$$\min(dp_{k,i,j}+1,j) \to dp_{k+1,\min(i,dp_{k,i,j}+1,j),j}$$$.Total $$$O(\sum n^3)$$$.
My code:
Image all N's are already replaced.
When 2nd player selects sub-segment, he tries to take max F's and min T's, specifically max(F — T) on sub-segment.
And the answer is {total amount of F's} — {max [amount of F's — amount of T's] among all sub-segments}.
Solution is O(n^3) DP. State is:
i: position which we consider (all to the left (i.e. prefix) is already processed).
f: amount of F's in processed prefix.
d: current balance of F's and T's (maximal cnt(F) — cnt(T) among suffixes of processed prefix).
Value of DP is best (minimal) balance.
Transitions are:
F: (i + 1, f + 1, d + 1)
T: (i + 1, f, max(0, d — 1))
2nd players uses new d to maximize best d (i.e. the DP value).
Final answer is amount of F's — best balance.
https://codeforces.me/contest/2238/submission/380519271
As neither a tester nor a participant, I can say after the round that C was a really good and interesting problem.
Can someone explain F solution.
First, you need to notice that you cannot fire two students if one of them is subortinate to the other one, unless you fire both of them in the same day, which is not optimal.
Now, all the students who has never been fired forms a tree.
If a student gets fired in the $$$(n-i)$$$-th day, the number of students hired in his subtree in the $$$n$$$-th day would be $$$2^i-1$$$.
Count the students hired in the last day, and you will find that the sum of $$$2^i-1$$$ among all fired students equals to $$$k-(s-1)$$$, where $$$s$$$ is the number of fired students.
This means, the sum of $$$2^i$$$ is $$$k+1$$$.
Now, you have to minimize $$$s$$$, so you should choose the biggest possible $$$2^i(0 \le i \le n-1)$$$ for each student.
The answer is $$$C(s-1) \times f$$$, where $$$C(x)$$$ is the number of different possible trees with $$$x$$$ nodes, which is the Catalan sequence, and $$$f$$$ is the number of different permutations of all the $$$2^i$$$ you need.
Upd 1:Oops, found a mistake in the note inside my code. Fixed.
My code:
In C if n=4 and the parents are like this 1 1 1 for h=1 and v=1 is there only one guild or more i couldnt understand this part
for h=1 and v=1 only one guild will be there {2,3,4}.
there is only one guild if you fix both v and h.
Thanks!
Nice round, I enjoyed the tasks :)
how to solve D i was unable to build an intuition :| .
.
Thank you guys for your contest it was so cool and I enjoyed it. I wish you all the best and continued success.
Subject: Appeal regarding submission 380502541 for problem 2238D (Unintentional Leak)
Hello Codeforces Administration,
I am writing to appeal the coincidence warning I received regarding my submission 380502541 for problem 2238D and its similarity to submissions by Anurag97 and Garima_badugu123. I want to be entirely transparent about how this overlap occurred.
The custom logic inside my solve() function—including the specific loop structures and variable naming—is my original work. I did not copy this from anyone, nor did I intentionally share it in any group chat, forum, or with any other participant.
During the live contest, I used JDoodle, a cloud-based online compiler, to quickly compile and test my C++ code. I was completely unaware that JDoodle does not secure code by default and that snippets can be easily scraped by automated bots via public URLs. It is clear to me now that my solution was unintentionally exposed to the public through this platform while the round was still active, leading to it being scraped and submitted by others.
For full context, the sieve() function at the top of my submission is a widely known, pre-published template for the Sieve of Eratosthenes that I keep in my standard toolkit. However, I understand that the strike is due to my custom logic being leaked.
I sincerely apologize for my negligence in securing my workspace during a live round. I respectfully ask you to consider lifting this penalty, as this was a case of unintentional leakage rather than deliberate cheating. Thank you for your time, understanding, and all the work you do to keep the platform fair.
I have got warning of almost same solution of this contest question number A. Submission ID:http://contest/2238/submission/380467525 I have read this problem on some sources on github on problem name Array_differnece a week ago from there i have read and used in the last contest. Kindly please remove my skipped for yesterday's contest. here is the source link : https://github.com/MK-VIONIX/MNIT/blob/main/Competitive%20Tips/Array%20difference.cpp
why do you have so many compilation error submits?
I get sometimes it can happen but man, running the code atleast once before submitting should be done, I get sometimes mishaps can happen while submitting but you have a unusual amount of compilation errors.
not to mention I saw a first submission to a question being compilation error not due to half pastes or anything but a typo in return and some other overloaded stuff, I am sure these stuff could have been avoided if you actually ran the code?
Subject: Appeal for Plagiarism Flag on Problem 2238E (Submission: 380512433)
Dear Codeforces Team,
My submission 380512433 for problem 2238E was flagged for a significant coincidence with solution 380483328 by gaurav225. I wrote this solution completely locally on my computer and did not share, leak, or host my code on any public platform. I believe this flag is a false positive caused by a structural convergence in our solutions. Below, I present the exact mathematical derivation and structural fingerprints that prove my independent authorship:
The constraints of the question can be reduced to a simple algorithm, which directly dictates the states used in my code. The no. of mistakes Chell makes in choosing the interval of fake cakes is just, T inside [l,r] + F outside [l,r]. So, the total no. of mistakes becomes T inside [l,r] + (Total F- F inside [l,r]) = Total F- (T inside [l,r]- F inside [l,r]).
Since Chell wants to minimize her mistakes and Total F is fixed, so we minimize (T-F) i.e. min(T-F) which is just -max(F-T). Assigning F=+1 and T=-1, the max(F-T) becomes the maximum subarray sum of the string, which is a consequence of Kadanes Algorithm.
On the contrary, GlaDOS wants to maximize Chell's mistakes, so we need dp to track both global and running max subarray sum. My code exactly does this using a dp with cur and mx. The further logic was simple as depending on whether we encounter F or T, the cur and mx values change accordingly. And, to optimize memory from O(N^3) to O(N^2), I used a standard rolling layer optimization via dp.swap(ndp).
I have built my performance on this platform through honest, independent practice. I kindly request that you review the structural convergence of this case and restore my submission standing as soon as possible. Thank you for your time and understanding.
Subject: Appeal for matching code flag on problem 2238C
Hi Codeforces Team,
My submission 380496146 for problem was falsely for plagiarism as I wrote this code entirely independently from scratch during the contest. ( my solution matched with Sri_avtar18 and Boptep )
The high similarity flagged by the automated detector is a complete coincidence due to the standard nature of the problem and the inevitability of the implementation.
My code uses a standard iterative Tree DP approach based on the given parent array a[i], Because the input provides parents for nodes 2 to n where the parent a[i] < i, the nodes are already topologically sorted. Iterating from n down to 2 (for (int i = n; i >= 2; i--)) is the standard way to process a tree bottom-up without explicitly building an adjacency list or running a recursion-heavy DFS. This is a common in problems like edge weight assignment, gardening trees (which I have solved) and links like https://codeforces.me/blog/entry/20935
While the core DP logic matches due to the simplicity of the approach, my unique coding style is visible, I initialized my tracking vectors b and c explicitly with -1 using vector b(n+1,-1); instead of clearing or using a global array, which fits my usual implementation habit, My variable naming choices (depth, maxdep, cnt, maxi) are standard, literal names that any English-speaking programmer would pick for this specific tree properties task.
I coded this entirely on my local offline environment and did not use any public online IDEs like Ideone.
Given that the logic used is identical to standard Tree DP educational templates, it is highly expected for multiple solutions to converge on this exact code structure. I kindly request the Codeforces team to review my submission and restore my contest rating.
Clarification regarding plagiarism flag on Problem 2238C
Hello Codeforces Team and Community, My solution 380508782 for problem 2238C was flagged for coinciding with other users. I want to clarify that I did not intentionally share my code or cheat. During the contest, I used the CodeChef online compiler to test my logic and run test cases before submitting. I was completely unaware that the online IDE could be publicly scraped by bots or other users during a live round. I wrote this solution entirely on my own, and it was leaked unintentionally. I now understand that safeguarding my code is entirely my responsibility. I have already switched to a local offline environment to ensure this never happens again. I request the organizers to please take this into consideration to protect my account standing. Thank you.
I received a plagiarism warning for my submission. I would like to clarify that I solved the problems independently during the live contest. I do not know the mentioned user, did not exchange code with anyone, and did not use or publish any public source during the contest. If there are similarities between the submissions, they are unintentional. I am willing to provide any additional clarification if needed.
I received a plagiarism warning for my submission. I would like to clarify that I solved the problems independently during the live contest. I do not know the mentioned user, did not exchange code with anyone, and did not use or publish any public source during the contest. If there are similarities between the submissions, they are unintentional. I am willing to provide any additional clarification if needed.
Dear Codeforces Team,
I respectfully request a manual review of my submission 380514626 for Problem 2238E, which was flagged for plagiarism. I wrote this solution independently during the contest. I did not view another participant's source code, exchange code with anyone, or intentionally share my solution through any platform or service.
My implementation is consistent with the coding style I have used across many of my previous submissions. In particular, I frequently do dp using rolling layers (dp/nxt_dp), initialize unreachable states to -1 or INF based on the formulation, perform state updates, copying the next DP layer back into the current one, and use helper update logic with max(...) or chmax(...) from my template. These are implementation patterns in my own solutions rather than choices specific to this contest.
While I understand that independent implementations of the same dp formula can share similar state definitions and updates, I respectfully request that my submission be reviewed individually. I would be happy to provide any additional information available. Thank you.
Explanation for Similarity Flag on My 2238C Submission
Hi Codeforces Administration,
I wanted to give some context on the match found on my 2238C submission from Round 1106 (Div. 2). I'd been away from competitive C++ for quite a while, so in the days leading up to the round I was using an LLM to get back into practice. During one of those practice sessions, it showed me a pattern for declaring a recursive function inside another function so it could still access the outer array/variables (the
auto&self lambda trick) — that's just what stuck with me, and I used it without thinking twice when I wrote my solution during the contest.Worth mentioning too: the actual approach here (keeping track of the top two subtree depths, max1/max2) doesn't really leave much room for different implementations — the core part of the function ends up pretty short and similar no matter who writes it, which probably added to the overlap on top of the shared coding pattern. I have no connection to the other participant whatsoever — never interacted with them before, during, or after the round.
I get why this raised a flag, and I'll be more mindful going forward about patterns I pick up elsewhere that might end up common across other solvers.
Submission: 380505706 of user Fyterox I wanted to clarify my submission because I believe the similarity is due to the nature of the problem rather than copying.
My thought process was to look at a few small cases ie primes, two-powers, and numbers with multiple prime factors and notice that the answer depends only on the prime factorization. From there, I counted the total number of prime factors and the number of distinct prime factors using trial division.
Since factorizing a number this way is the most common approach for (O(n), many correct solutions end up looking very similar, looping up to the square root, dividing out each prime factor, and handling the remaining prime at the end. It's short implementation with little room for variation.
You can find almost same implementations in popular youtube educational channels.
I did not copy anyone else's code, and I would appreciate it if my submission could be reviewed manually. Thank you.
I solved the problem 2238-C independently during the contest. I use the same local template files a.cpp, b.cpp, c.cpp in VS Code, so the final submission was written inside an existing file, which is why I do not have any history or last file edited things , unfortunately I saw the notification box during todays contest 1107 thats why the code file was already modified by todays contest code. I did not copy code from any person or source, and I did not share my code with anyone. The similarity is due to the standard approach and my thought process. If needed, I can explain the solution idea and my process.[submission:380500848][my file structure](https://drive.google.com/file/d/1znmQsdEteqeRVFP8gsUrmSXxI61Gqm9j/view?usp=sharing)
This contest helps me increase my rating to newbie to pupil.