Hello Codeforces
Thanks to these nerds for 15 winstreak on Hypixel bedwars
SpyrosAliv and I are excited to welcome you to participate in Codeforces Round 1047 (Div. 3) at Sep/07/2025 17:35 (Moscow time). You will be given $$$2$$$ hours and $$$15$$$ minutes to solve $$$7$$$ problems.
The round will be hosted by rules of educational rounds (extended ICPC). Thus, solutions will be judged on preliminary tests during the round, and after the round, it will be a 12-hour phase of open hacks. After open hacks all accepted solutions will be rejudged on successful hacks.
The penalty for each wrong submission in this round is 10 minutes.
Remember that only the trusted participants of the third division will be included in the official standings table. As it is written by link, this is a compulsory measure for combating unsporting behavior. To qualify as a trusted participant of the third division, you must:
- take part in at least five rated rounds (and solve at least one problem in each of them)
- do not have a rating of 1900 or higher.
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).
We would like to thank the following people for making the contest possible:
- Vladosiya for coordinating and Russian translations.
- sammyuri, nifeshe, Intellegent, and temporary1 for carrying me in Bedwars.
- The testers: Dominater069, __baozii__, nifeshe, satyam343, Intellegent, catgirl, Friedrich, cry, temporary1, -firefly-, efishel, 18o3, Arpa, AksLolCoding, Edeeva, reirugan, macaquedev, chromate00, pianapolataa, RobinFromTheHood, yse, Filikec, Non-origination.
MikeMirzayanov for Codeforces and Polygon as usual
Additionally, if you are a tester of EPIC Institute of Technology Round Summer 2025 (Codeforces Round 1036, Div. 1 + Div. 2) and you are rated for Division 3, I will ask you to not participate in the round, as it is possible you have seen some tasks before.
I wish you the best of luck and I hope you enjoy the contest!
EDIT1: editorial https://mirror.codeforces.com/blog/entry/146121








bad at bedwars
me too
bad at among us
among us is hard :( especially when you play with a pathological liar like nifeshe
Will you play with me? I always tell the truth, but people still lose!
I am still interested...... If u want then lets play
good at cf :) ?
As a tester, I can confirm if you are caught using generative AI, you'll be sent to Proof_by_QED's bed.
any time, any place
Right next to sammyuri's bed
I prefer cry's basement
As a tester, I indeed tested all recent rounds.
thank you for your service
As a bedwars player, I forgot to test...
as a tester, i played bedwars
Bro tested 10 minutes ago just to say this
i would never do such a thing
Why there is a lack in consistency of div2 rounds while the number of div3 rounds has increased
i dont think there has ever been any consistency
I dont like how its right now, like you have 3 div2 in a week and then no div2 for 10 days. although there might be a reason for this
Rounds are scheduled only when authors and coordinators feel that they are ready. Different authors and coordinators work independently of each other, so it may be the case many rounds are ready at around the same time, and it may be the case there are weeks without a round ready. That's just how it works unfortunately.
The Rounds Schedule has been extended, and we can confirm that he Proof_by_QED was correct!
tbf there were 3 div 2s last week and there are another 2 next week BUT THEY'RE ON WEEKDAYS
aren't you unemployed?
am I though
As a tester, I made a video of solving all the problems. Don't miss, learn how you can solve problems.
I thought it would be rick roll
I can neither confirm nor deny.
As a participant, I confirm this is not a rickroll
Hope i can solve 4 problems!
Good lock Sonic!
You too ,bro. I have been waiting for this div3 for a long time.
same bro
I wish i can solve at least 3 problem
Pray for me To solve 4/5 problems to reach pupil
upsolving by Arpa will be very helpful..
Regardless of whether you are a trusted participant of the "fourth division" or not, if your rating is less than 1600, then the round will be rated for you (unless you register unrated). Ig it's third division, correct me if I am wrong @Proof_by_QED
hope to be green this round :>
last div2 was scary need to solve 4 problems in this round to neutralize that
Hope i can change the color :)
can you please explain what do you mean by " Additionally, if you are a tester of EPIC Institute of Technology Round Summer 2025 (Codeforces Round 1036, Div. 1 + Div. 2) and you are rated for Division 3, I will ask you to not participate in the round, as it is possible you have seen some tasks before. "
I didn't comprehend it well.
Since you aren't a tester of Codeforces Round 1036, you do not have to worry about it.
so you also play bedwars
I don't see the option to register unrated. Help me out!
Approaching Blue :) Hope by next contest
Is it scientifically possible to become green after this?
Hopefully , if you solve 4 problem under an hour and total 5 .:)
Hope to reach Expert!
Yay, i did it <3
Why So Many Elements In MC???
"do not have a rating of 1900 or higher."
I think you mean 1600, right?
man i get 400ms on hypixel :(
Hope i can change the color.
I love this kind of short and clear statement. Thank you so much :3
Math/CaseForces
Wish I knew math ;-;
Pray you see tomorrow, you gonna learn
I reduced G to this. Make another graph of 2*n nodes where if there's an edge $$$ (u, v) $$$ in the original graph then there's an edge $$$ (u, 0) = \gt (v, 1) $$$ iff out degree of u is 1 and there's always an edge $$$ (u, 1) = \gt (v, 0) $$$. After this, the queries translate to this:
In query 1, we just have to add +1 to all the ancestors of node v in the newly created graph.
In query 2, if the value of (v, 0) at that point is greater than 0, then the answer is "NO" else the answer is "YES".
Idk how to handle the queries. can someone help? If my solution is wrong then also tell please.
Use two arrays to store whether Cry and River start at this node, and who will win. and do something like dp dp[node][whostart(0/1)] = who wins(0/1) dp[node][i] = for j in graph[node],any(dp[j][i^1]==i) something like this, update it when you update the ancestors and for the query, check the dp table
Just missed E
why the hell was C so hard lol
Same. It made worse that 12k+ people were able to do it and I failed.
Both F and G are GPT-able. This contest means nothing
GPT can achieve IOI gold. Would you want F and G to be harder than IOI gold?
isnt it GPT trained for IOI can get IOI gold and not normal GPT?
tried gambling on E but it was unsuccessful :(
cheatforces
Statement of F was not clear.
It's downhill from here folks.
Really, amazingly good problems! Thanks a lot for the round Proof_by_QED SpyrosAliv and all testers.
Also the people who gave the LeetCode round earlier today had an advantage in problem $$$F$$$ lol
The first ones are full of gray fraudsters with no record
are they being neglected or do they constantly come back with another account?
Also! the style of the questions was great!
I tried to skip as many suspicious submissions as I can during the contest. If you find any more suspicious submissions you are free to submit a report to https://cf-cheater-database.vercel.app/ with the link to the submission, and I will skip them if they are cheating.
What do you consider a person to be a cheater?
for example there are many people whose writing style is completely different for each question, or whose comments are very formal, or who solve questions E, F, and G in 3 minutes
and whose code style is very similar to artificial intelligence, and all they do is completely (and precisely!) remove the spaces between lines
while their rating after 10 matches is 1000
Proof_by_QED u are the biggest joker you have added my account Aslaan_Khan in your database. What I have done I have used AI to fix identation and you added. even you use AI to write your own blog what kind of jokers are there in cf. i think you have reached master by use of AI only. Dont misguide people by this useless database you are wasting firebase and vercel resources for this shit project.
problem E: https://mirror.codeforces.com/contest/2137/submission/337424480
Can somebody tell me why is this TLE even though its O(20 * N * LogN)?
when i changed if condition to k <= 10 and every other place, made 10 instead of 20,
O(10 * N * LogN) worked? can anybody explain why this happened? also i am not sure if my current accepted solution will really work, hacks are accepted!
Your time is close to 2e8 and the time limit
However, it was enough to do this operation exactly twice and after that only two cases will be repeated alternately
Operations:
Calculate mex for the array
Numbers that appear only once and are smaller than mex do not change
The rest become equal to mex
The problem is solved in O(n)
20*n*logn is approximately 70438561 operations right? isnt this less than 1e8?
I think they just have good tests to catch this.
You're missing an insight or being extra sloppy. Why are you applying the steps 20 times? You shouldn't have to apply it more than 3.
yeah i just did not want to proof the exact number :(
i just knew a large number like 20 would be enough, and i assumed it would be within the time limit so i just had to think less during contest
well, i just figured out the logn was from set which has bad constant factor causing tle. i wrote the mex logic by sorting the vector and it passed with O(20 * N * LogN) too!
no way. I solved e 4 min after contenst
I have published all my solutions from this contest Codeforces Round-1047 Div. 3 in a GitHub repository. You can find them here: https://github.com/AmbarMishra973/Codeforces-Contest-Solutions
Feel free to review the code. Feedback is welcome.
I think the test cases of G are weak. My O(n^2) solution got accepted. https://mirror.codeforces.com/contest/2137/submission/337441940
seems like it, feel free to hack
Screencast with commentary
I find what was wrong with my E 5 minutes after the contest ended. I started it 8 minutes later because I was talking about Silksong on twitter ;-;
Was able to get D and E, but I'm failing on C. What am I missing??
You can just assign K = B/2 if B is even or K = B if B is odd then apply the operation and print the result.
how do you know that's the largest even sum though?
for any numbers a>=1,b>=1 1+a*b >= a+b proof:
(a-1)(b-1)>=0 a*b-a-b+1>=0 a*b+1 >= a+b
and for 2+a*b/2 >= a+b ,a=2k>=2,b=2r>=2
(2k-2)(2r-2)>=0 4kr-4r-4k+4>=0 4kr+4>=4r+4k ab+4>=2a+2b ab/2+2>=a+b
So this must be one of the best solutions
I just tried all divisors, $$$d$$$, of $$$b$$$, from $$$1$$$ to $$$\text{min}(10000, \sqrt b)$$$ and for each $$$d$$$, also try the divisor $$$b/d$$$
Then get the max even sum using all those divisors
My intuition says the the correct divisor is somewhere near both ends lol
I should have just tried this for the hell of it haha
Think about a function $$$\displaystyle f(k) = ak + b/k \; (k \gt 0)$$$. If you differentiate $$$f(k)$$$ and think about the graph of it, you'll see $$$f(k)$$$ can be maximum if $$$k$$$ is minimum possible or maximum possible. So you only need to find out two cases: minimum possble $$$k$$$ and maximum possible $$$k$$$, and calculate $$$f(k)$$$ for each $$$k$$$ and the higher is the answer.
The rest is the casework based on the parity of $$$a$$$ and $$$b$$$. This is a bit tedious, but not hard.
(After all, you just need to test four cases $$$k=1$$$, $$$k=2$$$, $$$k=b/2$$$ (if $$$b$$$ even), and $$$k=b$$$.)
Am I the only one who thought this was going to be more connected with Minecraft/Bedwars?
Still bad at bed wars but maybe I just never got good teammates(I always protect bed)
It was a good contest, don't be tired, all friends.
any hint for f problem
Think wrt to each index i, in how many segments will they be able to take the value equal to bi.
not to complain, but i think the test data for f and g could've been slightly stronger since for both problems
o n^2 passes the test data in contest when the constraints should have made it nearly guaranteed to tle
My solution is O(3* n log n), but it TLEs on test case 9, and I couldn't fix it in contest. The number of computations is around 10,800,000 ~ 1e7, so I'm not sure why it didn't pass with 2 seconds time limit, maybe multiset is too slow. https://mirror.codeforces.com/contest/2137/submission/337442874
as a problem, I can confirm I was tested
How many problems should I solve in this competition to reach pupil?
i would say 4 fast or 5
OK,thanks!!!
good luck getting to pupil :)
"It doesn’t matter if you’re a little behind; what truly matters is that you’re still in the race, moving forward, and refusing to give up." It may have taken me time to crack ‘D’, but I did it—and that’s the victory. Siuuu!
How to solve the C problem? I mean that how can i think just like official solution. I can understand the solution but i don't know how to make it during a contest. Should i practice more?(Hope guys help me, i want to be stronger!!!)
Ok so first you realize that only 2 evens or 2 odds lead to an even sum. Then, it is also true that you always end up with a better result by multiplying with something, unless that something is 1. So now you split into cases with these 2 observations. If both are odd, you take a*b+1. If their product is divizible by 4 and b is even you take a*b/2 + 2 so it stays even. Other cases are impossible
For these kind of problems you should think about casework and some pen and paper. In my case, I thought the problem as just sending prime multiples from b to a, and worked from there.Solve more problemsThank you for this! I was able to solve 3 Questions. Need to practise more.
Where are rating updates ?
I think Problem E is easier than Problem B.I solved Problem E in just one attempt.But I didn't solve Problem B until the end of the competition.
I don't think so. I tried 6 times for E and I haven't solved it until now :(
bro is showing off, and how is B difficult lmao
i have solved b and c question along with a during the contest the submission was AC but now it is showing only have AC and b and c are showing "inqueue" i don't know why
System test cases are running on those solutions. If they pass the system test cases successfully, you will get AC on 'em. Don't worry.
I had registered for this contest as a rated participant but I see myself as unrated now? Can you please help me out. This was my first contest.
Participated in a CF contest after 4 months. Solved 4 problems. Was heavily penalized but felt good, hoped for positive delta & slept well. Came back home after classes only to find I had got MLE on TC 9 in D. Sad? Yeah I was sad. But still, it felt good. A nice contest. A good sleep after the contest. And a lesson. The funny part is that my rating remains unchanged. ;)
can someone see and say where my code went wrong
can u help?
I just change a little. click here. By the way, there is no need to use a map, because a[i] is less than n
this is my another account code
my English is bad, hope this can help you . :)
Yay minecraft! :)
Hello Codeforces,
I sincerely acknowledge that in problem D of Round 1047 (Div. 3) I copied a solution from an online source during the contest. I fully understand that this was a violation of the rules and an unfair action. I deeply apologize to the community and the administration for this mistake. I promise to uphold the integrity of future contests and only submit solutions that are entirely my own work.
Thank you for your understanding.
Codeforces system flagged my solution as plagiarised with someone else. That someone else is ee22b011 whose submission is this: https://mirror.codeforces.com/contest/2137/submission/337441561.
My submission time is 20:57 on September 07, 2025. Someone else submission time is 22:16 on September 07, 2025.
I solved problems in different order like, first I solved G then F. Someone else solved in order first F then G.
Codeforces system assumes there is central place where all solutions were posted and someone pasted there and I copied there. To make this claim sound legitimate they blindly tried to match my solution with this someone else. This is absolute wrong because someone else submissions follow a pattern where time of successful submissions between problem D, E and F are suprisingly too small plus, he/she does not use any short hand in any data type. Someone else uses int which is dangerous in some problems because overflow chances are high. I use lli by default to avoid such risks which makes it quick to not think much while implementing code.
There are lot of such non similarities between someone else and my code. Check properly for plagiarism. Don't blindly put plagiarism on anyone.
I will suggest codeforces to once again verify the same solution submission claim. I disagree with codeforces system message on my solution being plagiarised either intentionally or unintentionally.
If you think that I do not deserve to be at global rank 9 because you think so then still in further contests I can prove my worth consistently. You can observe my account.
Hello team
I received a plagiarism flag for my submissions in https://mirror.codeforces.com/contest/2137. I want to clarify that I solved the problems independently without copying or sharing code.
1)My code style is consistent with my usual submissions, random variable names, STL usage, and step by step logic. I do not use AI or pre-written templates. 2)I usually solve and save problems locally on my laptop (VS Code, Linux terminal). I can show my working files (1.cpp, 2.cpp, 3.cpp, etc.) and timestamps to prove independent development. 3)My Codeforces graph shows gradual progress. Between January–June, I didn’t do contests but studied algorithms and DSA, and only returned after consistent practice, which explains my significant improvement. 4)I can show you my intuition, logic, etc if needed but don't put this Plagiarism flag on anyone like that, I have worked hard to reach at this position. I don't want this to drop my ratings. 5)You can see by the timestamps that I sat for the entire duration of the contest and my timestamps are also not following a pattern, they are random.
I request you to review my submission again. I have put months of effort into reaching Expert (1676), and I would never risk that by unfair means.
Hello,
I'm writing regarding the plagiarism report for my submission on problem 2137E. I can confirm that the code was written by me and was not copied.
However, after checking, I realized that I had mistakenly left my code public, which I believe is the reason for the plagiarism report. I apologize for this oversight and will ensure my submissions are private in the future.
Thank you for your understanding.
I recently received plagiarism notifications regarding my submission 337391088 for problem 2137F and 213G. The system mentioned that my solution coincided with many other users’ codes.
I would like to clarify that:
I did not share my code with anyone, nor did I use any third-party platforms (like ideone with public settings, pastebin, etc.) during the contest.
I do not know the users whose codes were mentioned in the notification.
I wrote my solution independently during the contest.
If there is any unintentional similarity, it was not due to code sharing from my side. I strictly follow the contest rules and respect the platform.
I kindly request the coordinators to review my case. Please let me know if I can provide any further details to help clarify.
Subject: Appeal regarding submission 337429009 (Problem 2137D)
Dear Codeforces Team and Contest Team,
I received a plagiarism notice for my submission 337429009 on problem 2137D.
I want to be completely honest with respected team, I solved the first three problems of the contest on my own. For the 4th problem, because there was little time left, I made the mistake of using ChatGPT to generate code and directly submitted it. I actually didn't know the rules of plagiarism before. For proof I am also attaching the photos of notes I made during the contest(BELOW).
I now understand that this is a clear violation of Codeforces rules. I sincerely apologize for this action. This was my first mistake, and I assure you it will not happen again.
I fully accept if my contest results need to be annulled. However, I kindly request that my account not be blocked, as I truly wish to continue improving and learning fairly on Codeforces.
Thank you for your understanding.
PHOTOS OF MY SOLUTIONS Sincerely,
Ayush687141
Your solution 337352024 for the problem 2137G significantly coincides with solutions CyntaxError/337352024, Anichesschamp1008/337428853, ritupunia_12/337430226.????? my solution was sent at 18:19:06 and these two at 19:30:20, 19:32:06, like more than an hour later than my solution and these both solution sent under a minute, even if u compare both of these solution to mine 60-70% code dont match and these solutions follow variable naming which seems to written by ai. Get your shit together, first your sites go down during the contests and now blaming me of coping code from these people, yea sure me coping from these people who send their solution after an hour than mine. The contest was even unrated for me, atleast give me my rank back bruh.
Subject: Appeal against plagiarism flag — submission 337369606 Hello, I am appealing the plagiarism flag placed on my submission https://mirror.codeforces.com/contest/2137/submission/337369606 for [2137D]. I believe this is an error, and I request a manual review. Facts of my case: My submission time was earlier — I submitted at 21:32, while the accused (Jash_Ka) submitted at 21:51. It is impossible that I copied from them.
My problem-solving order was different — I solved A → C → B → D → E, while the accused solved A → B → C → D. This shows independent thought processes.
Performance explanation — My standing was ~2370 before the hack, which is a reasonable result for someone rated ~1193 who also practices on LeetCode and atcoder contests. I realize this might not seem reasonable for some but this is a div3 contest and I hope to show similar performance in future contests as well, if someone doing better than normal is unacceptable then that's a shame. And The system already penalized me when my C solution got hacked (dropping me to ~7.8k). The plagiarism flag is an unfair double penalty.
Coding style differences — I use #include <bits/stdc++.h>, shorthand variables, and lli by default. The other user uses expanded headers and plain int. These are habitual choices that don’t match.
Canonical nature of solution — The problem’s algorithm is very direct, so similarities are expected across independent submissions.
Conclusion: My earlier submission time proves I did not copy.
The similarities flagged by the system are due to the canonical nature of the problem, not plagiarism.
I respectfully request a manual review of my case and removal of the plagiarism flag.
Thank you for your time and for maintaining fairness on the platform. Sincerely, slazar06
My code doesn't even remotely match with others. Idk how or why I got flagged bro. The system is weird. I guess yall don't like someone doing better.
Hi Proof_by_QED ,
I got a plagiarism warning for submission [337362244]. I want to be clear that I solved this on my own — I don’t know any of the people you listed.
My first attempt was a divisor brute force (which TLE’d), then I realized it only boils down to a few cases and rewrote it. Because of how the problem is set up, there aren’t many different ways to write the optimized solution, so it’s natural that a lot of people’s codes (and even the official solution) look very similar.
I never shared my code anywhere and definitely didn’t copy from anyone. So this plagiarism warning doesn’t make sense. Please reconsider.
Dear Codeforces Team, My submission 337402821 for problem 2137D was flagged for coinciding with other codes. I would like to clarify that I wrote my solution independently during the contest, did not share it with anyone, and did not use any public platforms. The method I used is a standard approach to this problem type, so similarities with other submissions are coincidental. I respectfully request a review of my case.
Subject: Appeal regarding plagiarism warning — Contest Round 1047 (Div. 3), Handle: Nyxis_18
Hello Codeforces team,
My handle: Nyxis_18
Contest: Codeforces Round 1047 (Div. 3)
Submission ID: 337427302
I have received the plagiarism warning, and I want to clearly state that it was not my intention to breach the rules. I used external help (AI-generated code) which led to similarities in structure/code. This was a mistake and I deeply regret it.
I assure you that going forward, I will only use AI for understanding concepts and write all competitive programming submissions myself. I understand the severity of this situation and am hopeful for leniency.
Please review my case. I request you to consider this as an honest mistake, and hope that my account will not be blocked.
Thank you for your time and understanding.
Sincerely,
Nyxis_18
Hello,
I noticed that my solution for problem 2137D has been flagged for similarity with other submissions for the first time. I want to clarify that my code was written independently.
The similarity may have occurred because I used a common approach for this type of problem. I did not copy anyone else’s solution, and I was not aware that my code might resemble another participant’s submission.
I understand the importance of contest rules and assure that my future submissions will be careful to avoid any unintended overlap.
Thank you for considering my explanation.
Subject: Appeal for flagged submission – Problem 2137C
Hello,
My Codeforces handle is [swayamxup]. My solution for Problem 2137C (submission 337415060) was flagged as coinciding with other submissions ([337361974], [337415060]).
I want to clarify that I did not collaborate with anyone or share my code. I used my personal template and standard competitive programming techniques I’ve been using for a long time. I may have also tested code on an online IDE, but I never knowingly made my solution public.
It’s possible that structural similarities came from common approaches or standard templates widely used by many competitors. I kindly request that you review my case. I respect Codeforces rules and will be more careful to avoid any unintentional exposure of my code in the future.
Thank you for your time and understanding.
Best regards, swayamxup.