Hello!
On Dec/08/2024 17:35 (Moscow time) we will host Codeforces Round 992 (Div. 2).
The problems were written and prepared by Igor_Parfenov.
I would like to thank everyone who made this round possible:
- 4mda4mda, zap4eg, triple__a, Non-origination, _Israel_, ApraCadabra, FetFot, Dominater069, ezraft, thenymphsofdelphi, Pervushev, lxnu, Khomutov for testing the round and providing feedback to the problems
- Vladithur, for coordination of the round
- MikeMirzayanov, for Codeforces and Polygon platforms
- All participants
This round will be rated for participants with rating lower than 2100.
You will have 2 hours to solve 6 problems.
Score distribution: 500 — 1000 — 1500 — 2000 — 2250 — 2750.
Good luck!
UPD: Editorial
UPD: Congratulations to the Winners!
Div.2:
Div.1 + Div.2:








Shortest description for a Codeforce Round I've ever seen. Good luck all :)
I Love short description :)
I'm just glad that there isn't any interactive problem.
yeah me too
as a non-tester i love playing undertale
as a human, i also love playing undertale
what's the fun of playing undertale ? I don't get it.
Hopefully, the problem statements will be short and precise just like the announcement!
maybe the keyboards battery died after those lengthy problem statements so now we are left with this short description
possibility
Can you explain to me why does everyone care about score distribution? I don't get it. Does it correlate with the complexity of the problems? And if so, in what way?
Yeah higher the jump in between the problems higher is the difficulty change
So am i right that this contest is going to have a significant jump between first 3 problems? Cause it's much more often them to be like 500 750 1250.
You can expect so. Usually a distribution of 500-1000-1500 means the problems are rated around 800 — (1000-1200) — 1500 respectively. There are exceptions of course (the last two div2s having 800-900-1200 and 800-900-1300 for example). In fact, a 1400-rated problem B in one of the recent div2s only granted 1000 points.
I think that 500 1000 1500 is more common than 500 750 1250 though.
Thanks!
I hope to become Expert after this round 0 ^ 0
1
wtf , undefined
$$$x^x$$$ approaches $$$1$$$ as $$$x$$$ approaches $$$0^+$$$
Limits Magic Sir
https://en.wikipedia.org/wiki/Zero_to_the_power_of_zero
for example https://judge.yosupo.jp/problem/sum_of_exponential_times_polynomial
thx sir , I'm aware of this :D .
hey can you give me tips how did you rise up so fast?
I have studied CP for nearly 3 years but new on codeforces :))
i see thanks
My first unrated Div.2
good luck
Best of luck to all participants—let's enjoy solving and aim for new personal bests! ᓚᘏᗢ
everybody best of luck give your 100% with best wishes
I want a rating boost, so should i go with solving problemB first and then problem A?
If you get a WA at B its over
xD
Expecting increase in rating
As a tester, I hope you get a lot of green in this contest.
As a tester, the contest is a friend.
which includes green stocks?
P.S: it is only a joke. I never bought any stocks.
Well, neither do I, so probably no :).
it will be the rated contest number 100 for me <3
I hope to perform well in this contest ^_^
Hoping I could get to expert
Hopefully I wont choke on A this time :)
i feel so stupid failing c
patternforces
C is going straight to my suicide note.
Is F on Burnside's lemma?
can someone explain to me the idea behind b i feel too dumb tbh...
the optimal indicies for the first operation are 1, 4, 10, 22, ....
yea.. i thought it would be something like this but i don't understand why
wont the (r-l+1)/2 > the sum of 1s ?
after choosing index 10, then we have 10 ones [1, .., 10], and we choose 22, then we have 11 ones between 1 and 22, then all between will be ones also, and so on ...
a bit constructive first paint the cell 1 then check how much i can cover by painting ith cell that will satisfy l=1,r= ith cell ,then (i-1+1)/2
a pattern like 2*(curr+1) will be formed please write it on pen paper you will surely get it
my code : https://mirror.codeforces.com/contest/2040/submission/295579978
https://mirror.codeforces.com/contest/513/problem/B2
lol
Authors: solve the same problem for multiple testcases. lol
D is serious?
How to D?
Keep track of a value you will assign to the nodes, starting at 1. DFS and use precalculated sieve to determine when a parent-child value difference is prime, in which case increment the value by 1 until it is no longer prime. The number of increases is upper bounded by about n/2, which ensures the value never exceeds 2n.
Guessed it would be solved like this. Thanks!
Just fill everything in dfs with odd numbers starting from 1. When you fill children of some node u, skip odd number x + 2, where x is the parent's odd number. In the end you'll have at most one unfilled node, so just fill it with even number x + 1, where x is the parent's number. It works because the difference of two non-adjacent odd numbers is an even number greater than 2.
Thanks
Another solution: solve in dfs order for subtrees first, then when combining add 1 to the whole first subtree and starting from the second subtree add double the size of all previously considered subtrees plus 2 to the whole now considered subtree. After the first dfs, the final answer will be obtained by going to the leaves from the root and adding all calculated values plus 1.
Thank you
C I gave up on observations and just generated $$$n=8$$$ permutations and found patterns
that's the first thing to do for permutation problems
Can you explain further? Did you do this on pen and paper (seems like a daunting task), and if you did this via code — did you calculate S(P) for all of them manually?
Yes, I did this in code and calculated S(P). Python has many nice features that make this pretty straightforward and fast. You can use itertools to generate all the permutations easily and S(P) isn't too hard to code.
what was the pattern I sill didn't get it?
I started by thinking of maximising sum of intervals of each length. Realised you can't really get better than, say, for n = 5, for intervals of length 2 you can get at best 1 + 2 + 3 + 4. Then for length 3 you can get at best 1 + 2 + 3. And so on. And eventually realised that every piece besides the biggest one has to have as neighbors both a bigger and a smaller than it (considering the edges of the permutation to be 0). So essentially this is like going through the numbers in order and putting either smallest position still possible either biggest. So, like this, for example: n = 4
This can also be written then as either putting left or right. So for the given example it's L R R (you put 1 to the left, 2 and 3 to the right, 4 in what remains). And then finally when I started listing how all combinations of L and R would look I realised that this if you put the combinations in order, their results will literally be in the same order lexicographically, too (if you consider R bigger than L).
Same. I lost track with pen and paper at $$$n = 5$$$ so I just coded up a brute force construction method and then it's pattern seeking from there.
mathforces
Today I learned that 2 is a prime number :(
Lmao
C was too tough for pupil and specalist Guys.We cant even fight to solve C. Totally Disappointed
As a pupil, I did solve C
But an average pupil/specialist might not.
If average pupils solved C, I don't think they would be pupil
That C was way too hard for an average C. An average C is solvable for an average pupil.
I agree on it being harder, but I think people solving ABC are specialist, not pupil.
Nah, it's just a find-a-pattern problem, not much knowledge is required to solve it.
C is painful for me
No idea how to solve C :(
Do a brute force to find the optimal value sum first and then see all the permutations that give the result for some small $$$n$$$ like $$$7$$$. Try to see the pattern.
For $$$n$$$, there are $$${2^{(n - 1)}}$$$ permutations with a special structure.
I honestly dont get the point of questions like C.
I liked C but it might have been harder or just as hard as D, which is not very cool. Also someone said they found it somewhere on codeforces, so, it shouldn't have been in the contest.
nvm
I brute forced and saw the pattern for C, but I couldn't figure out how to implement it for 90 mins, got really frustrated by the end of the round
same, couldnt figure out how to do it without computing 2^n
2^n gets really big really quickly, so you only need to do it for small n (Like <= 50). Then the large case is trivial, because it will be bigger than k.
same bro despite of finding the pattern it is difficult to implement it Does anyone knows how to solve such type of problems please explain , it is much needed ?? Please
you can literally solve this particular problem by making observations and "wishful thinking". See my comment above. But yeah, running bruteforce and figuring out why it looks like that might be faster than what I did. Regardless, realising when to call it quits and run a bruteforce and pattern match is still a skill, isn't it?
same :(
help in d please
My thought process : choose 4 as diff and then choosing adjacent node
one will act as root and all nodes in it subtree will be 1 given 1 and increment of 4 , other with 2 and it increments
counter case : for star graphs case i can take other additions also like 1 and 7 for additional nodes,
can't implement it so need help
That would be quite weird to try to implement, so instead of using 4 as the smallest non-prime, use 1 and see where that gets you. That's how I did it.
tried implementing the same
These ppl didnt mention the function in B was ceil, and not floor, and spend half an hour on that lmao, next time hopefully they write its ceil function
The one that is closed on top ($$$\lceil x \rceil$$$) is ceil, the one with the closing under it ($$$\lfloor x \rfloor$$$) is floor.
$$$ceil(x) = \lceil{x}\rceil$$$
$$$floor(x) = \lfloor{x}\rfloor$$$
$$$round(x) = \lfloor{x}\rceil$$$
C was way too tough ig
I wasted so much time rabbit-holing in B... so I did D and then came back to B, spent another 20 minutes, and then finally saw the easy way to do it smh.
how did u assigned nodes
I answered how to solve D in a comment above.
is there anyone found $$$D$$$ was easier than $$$C$$$ ?
really thought so
i found it easier to solve, but much much harder to prove
can u tell why am i getting tle?
d
I think your problem is with this line
try to optimize your approach to find this value in $$$O(log(n))$$$ instead of $$$O(n * log(n))$$$
i found E < C < D
why is d getting tle d
This was not competitive programming, this was competitive math
more like get the k-th unimodal permutation competitive googling
Yeah, it seems to be a very fair thing to not tell explicitly that you are using ceil function instead of floor and then don't even add testcases to make sure it doesn't happen. There's barely a difference between ceil and floor brackets and anyone can genuinely miss it.
guessforces + how on earth none of testers noticed about C
dear problem setter, please never make problem like C again, never.
make this unrated wtf
I couldnt implement C for 1 hour I feel like I am stupid.
Am I the only person who really liked C? Only reason I found out it was hated was by looking in the comments
It is cool but it appeared before.
Once a Div.1E problem was already googlable , and the contest was rated
74 Magic
Yeah, that's really annoying (learned of that after I made the comment), but we've had contests where there's been non-original problems that haven't been unrated (see https://mirror.codeforces.com/blog/entry/135494?#comment-1219485 ), so it's possible that it will still be rated, but I can't say.
pretty sure your code is copy pasted. A lot of newbies and pupils have the exact same code as you. Its an already existing question.
1) If I copy and pasted the code, why would I have gotten a WA for my first submission
2) I do that in my submissions in-contest, eg https://mirror.codeforces.com/contest/2037/submission/291988558
And since you decided to change your comment's meaning, point 1 still stands. I've never seen the problem before, and I swear on that (for a bit of extra proof, here's the bruteforce solution I wrote in contest, Ik it's not perfect proof, since I could have written it after the contest, but here)
Well there are some coders who name variables very explicitly, like neal, for example. (I am replying to the first version of your comment)
yeah but when people below 2000 do it its usually gpt generated or copied from somewhere.
If you want more proof, here's a problem I solved before o1-mini was released: https://mirror.codeforces.com/contest/1993/submission/274367607
d is too hard for me :(
F is combinatorics, not constructive
Actually one of your homies loves constructive problems
I'm sure for many, the D task was an attempt to just stuff something stupid without even trying to prove it. It's a pity that I only managed to do it after the end of the round. Specifically, C was too heavy for me.
I cheezed D with a randomised solution. Basically, I guessed that the ratio of number of "unblocked" values to total values is never much lower than 1/2
haha loved that!
But can it be hacked?
Did you prove that there are no impossible inputs?
Who and for what reason decided to add -1 in Problem D?
That's quite common as to not spoil the solution. Alternatively you have to guarantee that solution always exists, but that is not always obvious.
If they wanted to make the problem better, they could have added that maximum node should be as small as possible.
I think the problem is good as it is. How would you solve the modification you proposed?
Not sure, But I would Try to change my initial code which got TLE on 24 test, were I find the diameter of the tree fill with numbers which have difference of one and after that go to subtrees by increasing the number with smalles composite difference and do the same in there, but not sure how to implement it yet to pass in time.
Problem C was exact copy of problem : https://mirror.codeforces.com/contest/513/problem/B2
This is extremely unfair to the people who tried this problem for the first time. This also explains why so many people were able to do this problem despite it being good enough that most of my expert friends couldnt do it.
My submission for contest problem : 295640125
Exact same code submission for older version : 295644907
I totally agree with you. What are the testers doing? If it's a problem from another country's website then I can understand why they accidentally made the same problem. But another exact same problem from codeforces????? Insane. It is really unfair for ppl who didnt try this problem like me.
I found something interesting while reviewing the official common standing: three participants younesg (rank 2), Constantor (rank 7), and zxc3 (rank 15)—all failed to solve problem D. Upon examining their code, I noticed a significant similarity in problems C, E, and F. Although they paraphrased the code quite skillfully, it’s evident from problem E that there’s clear code plagiarism among them (295598220, 295609438 and 295632243). I hope MikeMirzayanov and Igor_Parfenov can address this case.
lmao auto and consts to try to avoid plagiarism
lol
In E, how to derive the expression "2 * sizeof(vertex) — 1"? Though, i guessed, after this move, move parity will be odd, so, we can go back to the same vertex, using 2 moves and one substraction for parent.
at any vertex you have two choices(if the step is even)- either go down to one of the child vertex or go to the parent vertex... the probability of going to a parent vertex is 1/degree while going to a child node is (degree-1)/degree. let E denote the expected number of steps to reach parent vertex then E= 1/degree + ((degree-1)/degree)*(1/degree)+(((degree-1)/degree)^2)*(1/degree)+........ . Solving this you get the required value of 2*degree-1.
did thet tutrioal of D's second idea is wrong,the"write the values n*2,n*2-1,…"should be "write the values n*2,n*2-2,…"
Yes, it was a typo, fixed now
I encountered an incident where the code was found to be similar. Here are two submission records: https://mirror.codeforces.com/contest/2040/submission/295612672 https://mirror.codeforces.com/contest/2040/submission/295614629 BUT I'M NOT A CHEATER! Firstly, I assure you that I did not collude with him in the code, it just happened to be similar. Considering that this is a very typical problem and there are not many parts that need to be written, it is very likely that these two codes happen to be similar. So how to handle this matter?