Ready to Duel?
If yes, FetFot, Intellegent, and I are glad to invite you to Codeforces Round 1025 (Div. 2), which will be held on May/17/2025 17:35 (Moscow time).
This round will be rated for participants with rating lower than 2100. We will also be glad to see the participants with a higher rating to participate in our round unofficially!
You will be given 6 problems (with at least one interactive problem and one problem that has 3 versions) and 2 hours and 15 minutes to solve them. Also you can read about interactive problems here.
Please take a look at the score distribution; it may help you during the contest. Additionally, make sure to read all the problems.
We would like to thank:
satyam343, our great beloved coordinator.
Kaitokid, rui_er, TripleM5da, N_z__, _istil and Dominater069 for red testing.
ApraCadabra, The_Hallak, Vectors_Master, Mohanad_Nahhal, Wael_Zaiback, TyroWhizz, amoeba4, kingmessi, JagguBandar, Proof_by_QED, limbo16, 18o3 and myst-6 for yellow testing.
ALAov, Friedrich and THE_THUNDERSTORM_BEGINS for purple testing.
ZaiBug, larush, MaherSefo, jampm, Non-origination, ALnQ417, chromate00 and SpyrosAliv for blue testing.
The_Weighted_MST, Nahhas, lucaski2, theweakestsilver and segtreebeats for cyan testing.
- Alexdat2000 for the Russian translation.
- MikeMirzayanov for the great Codeforces and Polygon platforms.
You
for participating in this round and gaining positive delta!
The score distribution will be as follows:
To make this blog special, I'd love to share a picture of one of my favorite Yu-Gi-Oh! cards. It would be exciting if you could do the same and share your favorite card in the comments! Together, we can create a nice deck to play with.
UPD 1: Editorial has been posted. Check it out!
UPD 2: Congratulations to the top duelists!
All participants:
Rated only:
First duelist to beat challenge:
A: A_G at 00:01.
B: AndrewNguyen at 00:02.
C1: Narziss at 00:08.
C2: BurnedChicken at 00:10.
C3: golomb at 00:20.
D: sammyuri at 00:10.
E: hyman00 at 00:26.
F: dXqwq at 00:44.








It's a pity that I couldn't make time to participate in such a Yu-Gi-Oh! themed CF Round.
finally old score distribution has been restored, orzz to everyone involved in the conduction of this round...
Two Syrian contests in one year... You love to see it.
*Two Syrian contests in history
blue eyes white dragon
*Two Aleppo contests in history
Can you share the link of the first one please?
هاد كان جينزو؟
Satyam343, so we gonna hit a median related problem! Aren't we ?!
OMG C1/2/3 in this round
as a tester, this contest is amazing.
Another Syrian contest, let's gooo <3
I hope to perform well, the contest will start after an hour and 35 minutes of the end of APIO ^_^
Nice to See arabic people Create Constest .
As a monkey tester, I recommend eating bananas to beat these high quality problems.
As a tester I suggested to have exactly $$$x$$$ subtasks on one problem.
The value of $$$x$$$ will be informally announced after the contest.
UPD:
You should have given these 8..
as a tester, I just ate a mcspicy and it was pretty good
as a tester , the problems were really high quality!
Be prepared for this
As a tester, Maxx "C" is balanced.
*The most unbalanced card XD
As a participant I predict spending 2hrs on C.
*I did
As a tester, the problems are very great, and I can't recommend the contest enough.
Oh, and my favourite Yu-Gi-Oh card is:
Me to the authors to get the solutions
Pretty Interesting Score Distribution.
I've never seen three versions of a problem before. It looks interesting!
Yeah I'm already out of competition
As a tester, I recommend eating at Malak Al Tawouk before participating to boost your performance.
Thank you for the very educative comment
Should've taken notes before the contest :(
It has been 7 months since we've previously had a problem with 3 subtasks (the previous one was Codeforces Round 977 (Div. 2, based on COMPFEST 16 - Final Round))
Score distribution looks lowkey scary, will i be CM after this one ?
There is only one way to find out
"You jump when you're most scared, otherwise you keep standing at the same place" Let's freakin go !
You got this bro, all eyes are on you
all the besttt
Hope to have fun!
If I don't see a clear mind reference I'll be disappointed.
Whoa.. I am confused by the score.. Should I do div2D Or div2C-2 first.. Oh no!!!
That means, C is a 2500-points problem??? OMG... ...
I enjoy taking risks, so I'll go with this one
As a tester, I believe this contest is totally worth the risk and participation
As a tester, I will never forget this problem set!
As an imposter, I mean author, MOUFLESS is now officially striped like a penguin.
Hoping that problems will be easy
problems are hard ;(
As a tester, I enjoyed the contest.
OMG feels so nostalgic
that means C3 and C2 are easier than B ? or just because they are other versions of C, they had less score ?
A person who thinks all the time
has nothing to think about
Mirror Force — always ready for a surprise move
Unfortunately I only play the Digimon TCG. I feel like you need a whole dictionary for the damage step for Yu-Gi-Oh
how can i farm positive contribution im getting negative everytime
Well... what you're doing now is the best way not to do it
second syrian contest wow!!
The best strategy would be to move to D after C1 or at most C2.. Is that so ??
Hope it will be great as you guys!
Three attacks, one on C1, the second on C2 and the third on C3 :)
Best comment <3
Thanks:D
Swapping C1 with C3 is the trickiest move ever!
What do you mean?
The score distribution shows that C1 is worth 1250 points while C3 is only 500, showing that the problems are swapped.
Not necessarily!
That's the trick!
orz
What is this card thing? I dont understand.
Its a card game YU-GI-OU it comes from a comic and now become a famous game
I Played This Deck 7 YEARS!! I LOVE Mathmech!!!
Same my main deck <3
Its so powerful
+177
As a tester, i did not do jack sh**
How does 3 different version of the problem work. Should we like give 3 submissions ??
Yes. But the same solution might work for all 3 cases.
What a fantastic theme to choose from! I feel so bad that I couldn't participate, however, I want to show my support for such an interesting idea
Here is one of my favorite cards, as requested in the post :)
It's a pity that I couldn't make time to participate in such a Yu-Gi-Oh! themed CF Round.
I wish all participants success.
The Dark Armed Dragon is so cool!
I hope I manage to solve all the 3 variations of problem C.
hard A
You poor girl...
How did SO MANY people (I'm talking 1000+) solve C2 immediately after solving C1? Is there an easy trick to doing it in 4 commands after getting it in 7? I solved C1 relatively early on and couldn't solve C2. I don't get it -- can someone please enlighten me?
Usually try to solve the harder version of the problem then the code for easy and hard will be same.
They aren't connected, but the only observation you need for C2 is that multiplying by 9 does nice things to the digit sum.
What does it do?
Multiply by 9, take sum of digits twice (now you always get 9) and then add n-9.
I didn't really understand what they were looking for with 7 operations tbh.
My solution for C1 took the sum of digits twice (it is now guaranteed that x<=16), then added -8, -4, -2, and -1 in succession. At the end of all that, you have 1, so you just add n-1.
how do we know it will only take 2 operations to reduce to 9 and not 3 ?
9x has at most 10 digits, so S(9x) <= 90.
Also S(9x) is a multiple of 9, so it's one of 9, 18, 27, ..., 90, all of which have digit sum 9.
wow.. this is so cool.. thanks for sharing this idea.
If u solve C1, Change
mul 9intomul 99then u can solve C2Unfortunately, I didn't use any multiplications in C1, so I spent 40 minutes to work out C2 :(
It either you're lucky to recall quickly that S(x) === x mod 9 or no.
I suppose you did "digit" operation twice and then binary search in C1? Well, then you definitely observed that S(S(x)) <= 16 here. Hence you can first do x*=9, then take S(S(x)). You can see that S(9*x) still <= 81 and thus S(S(9x)) <= 16 and since 9x is divisible by 9, S(S(9x)) = 9.
Was F using dinic's algo?
Something like this (its in go lang)
tf do you mean you can get 100 in 3 operations...??
Can somebody please describe strategy for making x = 100 in 3 moves for any x?
you can multiply x to a number first (rather than calling digit) to force the sum of digits to be a constant
???
Multiply by 999999999, sum of digits is always 81
Thanks. I did try that but when checking that S(999999999*x) = const, i was checking a random segment [rng, rng+10^6], but forgot to take rng%10^9..... lol
Multiply by 999'999'999 and then take digit sum. It will always be 81.
A tricky edge case is n = 81 where you should immediately report "!" instead of adding n-81
multiply by 999999999
then the sum of digits will be for sure 81;
so then digits and add n-81
did you derive this during the contest ? How to approach such derivation in future ?
This was quite a non-standard task so there isn't any formal way of doing it.
Listing down ideas help like(this is what i thought of):
3 times "digits" and get a single digit number
division is not very useful
there are just 9 numbers what can multiplication do?
then you notice that multiplying by 9 keeps digits same(i thought of 11 and many other numbers too)!
this was sufficient for C1 then for C2 you realize multiply by 9 then "digits" twice will give 9 again so a 4 step solution!
this is how far i got in the contest(i did not participate but solved the problems separately) later is saw jiangly's code and saw the 999999999 thing and it did feel like a continuation of what i did for C1 and C2. Maybe i was just too lucky not going for the reduction by 8-4-2 path (it just didn't click then)
Why this solution for C1 is giving command limit exceeded ?
https://codeforces.me/contest/2109/submission/320122515
You forgot to read this response.
After
cout<<"!", you shouldcin>>, because it will return whether your answer is right.I like E very much <3. Also, C3 is very cute lol
yay <3
On C2 I had the biggest brainfart in my last few years. I literally was able to come up with the idea of making $$$x = 9$$$ in just three turns and for some reason wanted to make it $$$x = 1$$$ to be able to multiply it by $$$n$$$ (which is impossible, since only one turn left) and completely forgot about the option of adding $$$n - 9$$$.
The problems are great though.
Not able to solve a single problem feeling low.........:(
Should've slept in today.
how to solve D/D/D ?I was thinking of finding maximum odd/even we can get from multiset then if distance is even and <=maxeven its true else we can check if we can make it jump to some other node that has answer statisfied???
I wanted to name our ICPC team "Decode Talkers" but they refused xD
WHY THE F8CK THIS IS GIVING WRONG ANSWER FOR C1. Is there any slight mistake which i can't see because i think my logic is correct... anyone help. It was the worst contest for me i suppose.
320120108
You forgot to input a number after guessing.
I didn't get what you are saying. Could you please clarify?
You are supposed to input either '1' if you guess the solution correctly or '-1' if your solution is incorrect.
Got it! Thanks. I am an idiot.
why do you add $$$n - 9$$$ and not $$$-8$$$?
So, after performing "mul 9" and 2 times "digit" operation , we know x will be transformed to 9. Now 9+(n-9) will result in n.
are you reading in 1 or -1 after you output "!"?
Oh no... I didn’t read the question properly (kill me). I thought the final response would always be '1'. Anyway, thank you!
Very very nice problemset
In C1, if you do three times
digitcommand, you are probably screwed for entire contest trying to fix yourBinary Search.I Can't understand, why such trick ( simple trick, just do 2 times
digit, and reduce 8-4-2-1 ) question. Why not allow Binary Search to pass !!C1 and C2 both are trick based questions... WHY !! At least let one of them be logic based ...
I was doing
digitthree times for more than an hour.Same. It feels like wasted more than 1 hour of life. C2 solution is even worse.
Bullshit C problem in my opinion.
I regret wasting time on C, should have just skipped straight to D.
we can digit 3 times, then multiply by 9 and digit again, now x is 9, then add n-x.
Seems like C2 solution under-the-hood...
I wasted 40 minutes because my brain told me 9*9 = 89
I was doing
digitthree times at first, but I realized that whatever value we tried is at most guaranteed to eliminate $$$\lfloor n/2 \rfloor$$$ possibilities (assuming you were adding negative numbers like I did), so I knew there was no fixing it since we start with $$$9$$$ possibilities.Akash_184's code style is beautiful with super long AI style variable names.
thats camel casing which not AI....
Yes I can see that sometimes you use big camel style and it's ok. But your coding style changed on E here. Where is your
file_i_ofunction andsolve? Besides, the variable names are too long for cp. Do you agree?oops i typed max instead of min somewhere on D and didn't find out until right after contest ended
rip demotion unfortunate
C2 was cute, I liked it, even though it took me a while, it felt nice to get
Can someone explain, why my approach is wrong problem B? At first, i try cut max square from initial position. Then change board size, in loop take as mid = {n/2, m/2}. Submission
I did same. But it's wrong, we don't always want to cut the max area
Test for this case- n = 50 m = 1000
a = 1 b = 50
Can someone help me with what is wrong with my logic for C1 or anything wrong with the interaction format?
320133076
if x=4,then your x will never be 1 but instead it will remain 2
there is a while loop inside the for loop if it is divisible it will again do it until the response is false from the ask function
BLACKCOFFEE-420 it can convert any number to [2,9] to 1 in at max 4 operation
it can't imagine a number 8,then for 3 times ask will get execute for first quesry output=1,x=4,counter=3 second query output=1,x=2,counter=2 third query output=1,x=1,counter=1 fourth query output=0,x=1,counter=1 now for p=3, it will again ask div 3,it will give zero so it won't execute command after && now for p=5, it will again ask div 5,it will give zero so it won't execute command after && now for p=7, it will again ask div 7,it will give zero so it won't execute command after && no of queries for digit=2,ask=7,mul=1,tot=10
ok got it thanks
Passed example input/output on problem E just 5minutes after the contest ends. What a pity.
I didn't notice $$$x \le 10^9$$$ and used C2's method to solve C1 :(
Can anyone help me with c1?, I don't know why in the case n=5, x = 1234 fails
Hello, what is the solution for B? I did greedy by reducing the rectangle with by the slice that cuts the most area each time, and placing the monster in the middle of the grid each time, but I got WA on pretest 2.
Same! Wasted my whole time debugging it.
not most area, for first slice I took 4 cases and sliced each direction in each case after that position of monster is irrelevant you have to keep halving the dimensions till both dimensions reach 1.
So do you brute force to try all 4 cases?
same bro, guess we're dumb
I'm gonna lose some rating from this one LOL
what is blue testing? yellow testing? red testing? What does it means? why different testers for different colors?
Testing from different ranks basically, colour represents ranks and each rank is invited to test so there is kinda like a survey conducted between different skill levelled people.
Can anyone pls explain what i did wrong here. My logic was to update x to the sum of its digit two times which will convert it to a number [1,9] then in 4 operations I can convert any number from [1,9] to 1 and in last operation multiply it by n
you would need 3 digit operation to convert to single digit, say first digit give 79, second one gives 16 and third would give 7. so 2 wont be enough
what is this? what if after 2 "digits" the x is now 9?
after digit, you need to take input.
After few of the "cout" statement, you are missing "cin" statements.
The value of x can be [1,16] after using digit operation twice so 11 and 13 cases wont work
I hope it's the last syrian contest ever :)
The last one was even worse by the way.
C3 is based on a conclusion that:
What was the intended TC for Problem E ?? Was O(N * K^2) expected to pass ??
as a participant. i got cooked
Since, system test is pending, can anyone please check my approach for d?
I solved it in the same way and passed.
So did you check the case that odd numbers don't exist in A?
Yes. Thanks
Can someone please help me out that why does this code fails,it relies on making 1<=x<=9 by using three x digit calls,then using binary search on[1,9] where if returned value is 1 then start=mid+1,end which is then made as [1,end-mid] and [1,mid] otherwise .It has been called twice making x =1 or 2 ,now by this it is ensured that end-start==2,so i now print add(N-1) whatsoever.
(The number in square brackets is the value of x before being modified by that query)
Thanks alot but How did you come with this debugging testcase.I mean is there a resource where i can read about this?
I wrote an interactor during the contest to debug, and made a testcase with random inputs (but N = 1)
Any reading resource regarding that,I want to learn how to make one for future
Sorry, I don't have any resources regarding this, but this is the grader I wrote:
As a participant, I solved C3 but I will get negative delta because of B :(
Gonna play saber fighting for a lifetime!
guys, I participated in the competition, I solved some problems, they were judged and accepted, but there was no score, is this normal?
problem C is very nice
C is so adhoc XD
In problem D, you said A is a multiset. But in the hidden test cases, A is not always sorted. The problem statement should have been more clear.
A multiset is not definitionally sorted, although the C++ implementation is.
It was supposed to be the arrival cyberse but the image isn't loading
So sad that I wasnt able to live participate in a Yu-Gi-Oh themed div
Rating Estimations:
A — 800
B — 1200
C1 — 1400
C2 — 1500
C3 — 2400
D — 1900
E — 2300
F — 3400
C3 deserves more score than D and E. Biased distribution.
This was one of the best divisions I've ever participated in Codeforces. I really loved the layout of C, even though I only solved the easy version.
Rip in interactive
Problem setter for this contest needs to be appreciated. Upvotes on this blog proves it.
Subject: Appeal for Submission 320130836 — False Plagiarism Alert Dear Codeforces Administration, I am user fengxiabcd, writing to appeal the plagiarism alert for my submission 320130836 in Problem 2109D. The system flagged similarity with user mahskas_17's submission 320128554, but I assure you this is a coincidence arising from independent problem-solving with a common approach. Key Points: Common Algorithmic ApproachThe solution relies on widely used techniques in competitive programming: BFS (Breadth-First Search) for calculating shortest paths, a fundamental method in grid traversal problems. Parity Check to determine reachability by adjusting steps while maintaining even/odd distance properties, a classic approach in parity-based problems.This strategy is natural for the problem’s constraints and widely adopted by independent solvers. Independent Code ImplementationWhile there may be superficial style similarities, the actual variable and function names are almost entirely different, reflecting independent coding habits rather than copying. Timeline and Impossibility of PlagiarismI submitted my code within 1 minute of mahskas_17’s submission. Plagiarism would have required completing extensive modifications in mere seconds, which is technically impossible: Analyzing and understanding foreign code logic, Rewriting all variable/function names, Debugging my own code issues (e.g., fixing long long type errors).The sheer volume of changes needed contradicts the time constraints, proving the code was independently developed. Request: I kindly request a review of the code’s naming conventions and problem-solving logic to confirm the similarity stems from common algorithms, not rule violations. I am committed to Codeforces’ integrity and can provide further evidence if needed. Thank you for your attention. Sincerely,fengxiabcd Email: [email protected]
To MOUFLESS
thank you for taking my rating moufless because now im saved from bullying
anyways i still wwant to tell you that with proofs i can tell i did'nt cheated
i have video of me solving that question
and i wrote that code live
on youtube
and it is clearly visible that in my live stream i did'nt use ai
Catching cheaters is not my concern. If you want to present your proof, you can talk to someone who has strong permissions and access at CF.
where did my rating go?