Hello Codeforces! (你好, Codeforces!)

Kaey and I are glad to invite you to Codeforces Round 967 (Div. 2) which will start on Aug/20/2024 17:35 (Moscow time).

The contest will last for 2 hours with 5 tasks for you to solve, and 1 task will have subtasks. The contest will only be rated for those with a rating not higher than 2099, but higher rated users are also more than welcome to participate out of competition. There is at least one interactive problem, so please read the guide for interactive problems if you are unfamiliar with them.

Holding the contest would have been impossible without the help from:

- Kaey for supercalifragilisticexpialidocious coordination.
- feecle6418 for providing idea of one of the problem.
- BurnedChicken, cheissmart, SorahISA, WiwiHo, Fysty, Potassium, Emilan, Wayne_Yan, sam571128, Darren0724, HNO2, FoodSheep, Aestivate, jamesbamber, franv, jakao, warner1129, guagua0407, ub33, Bossusuprem, AverageAmogusEnjoyer, _hq8398_, XDEv11, Qualified, temmieowo, kenkenken, ayhan23, DanielMontes, TLE_Automaton, Mohamed_M.M.R, BaoCoder613, alls, Vamperox, Ahmad_OS, AdunAdunov, ciao_gio, baibaiouo, VelajZmaj, pandaa73 for testing and giving useful feedback to make the round better.
- Alexdat2000 for translating the statements to Russian.
- MikeMirzayanov for Codeforces and Polygon.

The score distribution is $$$500 - 1000 - 1500 - 2000 - (2000 - 2000)$$$.

Good luck and have fun!

UPD1: Editorial

UPD2:

Congratulations to the winners:

Div.1 + Div.2:

Div.2:

Excited to see the problems! Misuki Kaey orz!

As a tester, I forgot the number of interactive problems there :)

Misuki orz!!

Interactive problem ❤

As a tester, I can confirm that the round is supercalifragilisticexpialidocious, too.

I believe that Misuki's dedication to the round is definitely worthy of honorificabilitudinitatibus!

Bro, I solved 2 questions in this round without any resubmissions or wrong answers and my rating decreased by -6, can u tell me why that is. I'm new btw

Bro, I solved 2 questions in this round without any resubmissions or wrong answers and my rating decreased by -6, can u tell me why that is. I'm new btw

You have submitted them too late. Submission time also matters.

Really, I mean is it not like ur rating increases by lower points rather than it decreasing.

Your rating only depends on your rank in the contest, irrespective of how many problems you have solved.

I came here from the author's

XpostMisuki orz!

As a tester, I tested the round.

I like the problems btw

As a tester, I ate 2 bags of chips while testing.

As your sincere friend and a member of the_coding_pooh 's fan club, I wish you stop emoing and go find a better life. Chips only make you as fat as me!

Friendly advice: chip crumbs can greatly stain/dust your keyboard, especially so if that was a mech key. Stress snacking is okay but don't let them damage your own equipments.

Misuki orz

interactive problems..cool

nice dp

Hope to reach -110 after this.

hi

me -10

Who told them to say 1 or more interactive instead of 0 or more :)

Let's do our best

As a tester, I can confirm that the round is supercalifragilisticexpialidocious, too.

Good luck to everyone, and orz to Misuki!

Hope to reach 1300+ rating and solve ABC!

+1

oop I ended up not taking the contest bc SAT prep

I feel like I could have solved AB in <10 mins tho

I participated in the contest and got a mountain-like graph. Hopefully will do better in upcoming contests

same i got like a math test tbh and slept

As a tester, I recommend solving AtCoder problems if you want to be as good as Misuki!

Hmm, looks not good enough then. What should I solve to be as good as tourist?

What does the score distribution mean?

if you solve the 1st problem at exactly 0 minutes after the contest started, you will get 500 points, for the 2nd problem 1000 points, etc.. over time the points that you get per problem decreases, so these values are not constant.

Thank you for your explanation.

As a tester.. i hope everyone get positive delta..

hope for new color

and hope for Salah7_a

O

hope for you too dear Swayam78

Hope back to blue man :)

After getting down by the allegations of CHEATING, still standing to become RED

As a tester, i did nothing

I think this round will be great.

Hopefully, the color of my username will change

ill solve ABCDEF , ggez

`The contest will last for 2 hours with 5 tasks for you to solve, and 1 task will have subtasks. The contest will only be rated for those with a rating not higher than 2099, but higher rated users are also more than welcome to participate out of competition. There is at least one interactive problem, so please read the guide for interactive problems if you are unfamiliar with them.`

please read it.

I think you are referring to E2 as F. problem E got subtasks so it would be labeled as E1 and E2, rather than E and F.

What's the point of bringing this up? A tester is not supposed to give extra info

are you serious?

This is not extra info, sadly. They were just repeating the thing you should have known by reading the announcement solely.

cheater should shut up

As a participator, Thankyou for

Interactiveproblem ❤️As a participant all the best to all my fellow coders

All the worst to my fellow coders. Idk about you but I'm tryna beat people.

I am with you for the later part.

What do you mean dude? Everyone will get positive delta.

real

.

I want to get +2500 in this contest

and beat all of you

it's so over

hope cadidate master today:3

Why did a game a long time ago change from scoring to not scoring, and the questions passed were also displayed as skipp

Why did a game a long time ago change from scoring to not scoring, and the questions passed were also displayed as skipp

you cheated. happens to the best of us.

Thanks to everyone who make this contest happen! Let's go!

ready for another opportunity to come back to cyan :)

Interactive Problems after a long time...

Hope to reach Specialist after this contest.

Misuki so strong!!!

Giving a contest after almost 2 months, hope I don't get destroyed..

Misuki

*(in the non-decreasing order)

I really want to participate in it,but it's a pity that I don't have time...

I hope to solve A,B,C

so orzful for this contest <3

interactive problem will have two subtasks most likely

Taiwanese? I had to participate!

With a heavy heart and determined spirit, I'm back for higher +ve deltas

It can be a big challenge for my to solve interactive problems. But I have to try my best because I don't want to find my Rating going down again after the competition. It's really depressing!

Oh, I did it! My Rating increased! ahh!

Hope to slove A,B,C and D.

wish I could become 1200 rating after this contest!

yeah! I did it!

good job!

Hope to accept A, B and C

As a tester, I did not test the problems.

Wish me to boost my rating in this round. And Good Luck Friends!

Going to participate after almost a year, let's see what happens.

Couldn't join the contest for 15 minutes. Am I the only one experiencing this?

Why is C of trees I am gonna be Pupil again

Poorly written B.

Absolutely LOVED C! Took me a lot of time, but that was SATISFYINGGGG

i have absolutely no idea what the solution is, i think i will go back to pupil

once you will see it, you will be like "oh its so easyyy, i am so dumb" lol

Bro thank you so much, I raged because of B and you motivated me to look at C again and I solved it in literally 10 seconds.

W :)

is it just me who thinks they should have mentioned the word cirular array in A to make things clear. I was breaking my head thinking how 8 8 7 6 3 8 7 6 3

can be convert to equal array

they literally did, in the first line brother

ah shit, idk how i had such a blind spot. i didnt read that. apologies

it is mentioned in the problem statement.

Could only solve one.

Got humbled by C so hard, speedran A+B in 10 mins feeling positive, just to get completely stuck on C with -7 at 15 mins left and no clue how to proceed

B took me a while (I jumped to C before solving B) (I hated the way it's written), but for C, for me atleast I thought this way: let's root the tree at 1, this way for every other vertices, there is a segment between the 1 and that vertice right? okay now suppose you query the x between a and another vertice, for sure it's in the middle right? so for every line in the tree starting from 1 as a root and you query 'b' for example, now you can solve for the segment a,b recursively, solve(a,b)={ if ask(a,b)==a -> a line between a and b, otherwise ask(a,x),ask(x,b)} now suppose that there is a segment like this 1 — 2 — 4 — 6 — 8 — 9 and you queries solve(1,6) so you have all the segment 1,2,4,6 next time ofc you ll not query something that you constructed before so hold a visited state ! , say next time you ll query for solve(1,8), I claim that to solve(6,9) you ll get to this solve in log(the length of the segment) why? because you gonna ask(1,8) and you ll get 4 but you already constructed 4 right? so now don't ask solve(1,4),solve(4,8), just solve(4,8) => segments gets to half eatch time so it 's a log. and we have 15*n queries , max of our log is 10 as n is 1000

This was the first thing I wrote, but I probably messed it up somehow, because I would get -1 on test 3. Spent around an hour trying to find where the program fails before trying to figure out how to approach the problem differently (with no results)

you missed the binary search aspect,

SpoilerNot gonna lie, it took me like 4 hours to finally understand how the solution works, even after looking at like 5 different explanations. It's so simple, idk why it was so hard to see

ALame problem + Bad statement

BBad statement

C & DNice Problem

Stuck on WA 3 for D, can anyone share some small/tricky testcases?

same

Here's one that I failed on:

Answer should be:

An even simpler one I failed on:

Answer should be

thanks your test case worked, did cf permanently remove the feature to look at test cases?

finally changed colors!

hey you are the iq guy

he is changing to low iq guy color

Worst contest ever

problem C is cute problem I think, didn't realize binary_search can be used in such way until very last minute.

but I still cannot believe how 5000 people come up with solution in time. like how this problem have rating difficulty of 1500?

I didn't use binary search at all.

Simple recursion with DSU: https://codeforces.net/contest/2001/submission/277397822

can u explain it sir

In fact, it is very similar to editorial solutions.

For each pair of nodes

`i`

and`j`

that are not currently in the same component (I used DSU for this, but a simple`visited`

array will also suffice), we do the following recursion (`v1=i`

,`v2=j`

on the beginning):Find the closest node using the

`?`

query.If it returns one of our nodes, then we can union the two components together since they are directly related.

Otherwise, we know some node that is in the middle of our nodes, so we can call the recursion with

`(v1, mid)`

and`(v2, mid)`

. So at the end of such a recursion`(v1, v2)`

will be in one component (`v1`

in the same component with`mid`

;`v2`

in the same component with`mid`

=>`v1`

and`v2`

in the same component).I didn't think much about the count of used queries, but I assume it's O(n).

I believe solution would have been leaked somewhere ;)

knew i was cooked as soon as i saw A

and i was, time to return to pupil ! yayy

need 2 more minutes for D :(

I am so dumb that 17k solved B and i didn't even understand the question until now :(

Someone please explain the problem statement.

you have an array of numbers from 1 to n, lets call it arr, and an array of -1s, lets call it res. you can start from either side of res(the start or the end), and you can also return to the side from which you started. you can also move towards the side that you didnt start at. you can place the smallest number in arr at the position you are at, and you can do that until arr is empty, and res is full. construct the array res, so that from whichever end you start, if you do the operations in an optimal way, the amount of return operations to the starting side, is equal. i hope i clarified it a bit, and i can give solution too if you want.

Could you please take n = 5(say) and explain the problem with it, like an example. The explanation given along with the problem was literally very bad!

for n = 5 I tried it on copy and come up with 5 3 1 2 4 as a solution and saw the pattern and coded it

Could you explain how you approached?

I was trying hit and trial as I was not able to understand when I need to return carriage approach was like if I need equal permutation from both the typewriter with equal carriage being used then for first typewriter when I move left then I need carriage and for the second typewriter I move right I need carriage so for making it equal I need to do it from middle only which is possible for only odd n and not for even n

C was fun. First time trying out an interactive problem.

It took me more time to understand problem B than it took to actually solve it

Huge praise on C. I'm glad that I didn't have to do the binary search myself today (and pushed the heavy job to the interactor).

lol

could you explain C, i am clueless about trees, so i just skipped it and solved D instead

Pivot a random node (in this case I'll use $$$1$$$) as your "root". Traverse each and every other node (denoting the traversing node $$$i$$$), and perform the following:

The catch here is that we'll use the interactor to binary search for us to reach a stray node's "parent". We'll finish the tree structure when all nodes found their parents (except for $$$1$$$, as it's pivoted as root).

Total query count should be approx. $$$10n$$$.

ahh I think I understand, thank you!

can you please check why mine was failing on pretest 3 277415822

what is wrong with this sub 277402675

Once again, D got leaked on a certain "YouTube channel" (as expected), with about

1k viewsin just one hour before the contest finished :)that's so fucked. I wonder if there's anything we can do about it

gotham needs batman

Can we just mass report this one YT channel so that we don't have this many cheaters? (Honestly, I don't really want to mention it because there is a probability that someone will use it to cheat in future rounds)

they will search anyway

The statement of B is very bad. Lots of cheating again (near 5k official solved C).

In Problem B, if there are 3 different operations, and you ask us to minimize just one of them, at least highlight it please?

My implementation skill is getting worse and worse.

Hints for

D. Longest Max Min SubsequenceConsider the first index where an element appears for the last time. Since this is your last chance to take this element, you have to construct the best sequence that you can using the elements to the left. Hence, greedily take big and small elements to the left (while ensuring that as soon as you take an element, you invalidate all its left neighbors). Then, if you have taken an element, you can say that this element will never contribute to the last occurrence anymore.

Hence, you greedily take elements at each last occurrence of alive elements.

omg my solution was so close. I forgot to invalidate the left neigbours when doing the greedy construction :(

Nice one. Just greedy. No fancy DS.

ayy just look at rank 1166 , tanish-jindal his D solution hahahah, just blatant cheating with stupid variable names

a lot of people have this D lmao

Watch out for these leaked solutions

Problem CProblem DProblem E1at that rate we gonna see lot of Master cheaters

Bruh E1 ?? seriously ??

shreeyac writing IIT Bombay in bio, and then cheating lmao.

damn, cheaters solving E1 in div2 is crazy

leakforces!

After looking at solutions for D for a few minutes:

277373431 mole1

277403705 CipherSage

277385845 huddybuddy

277390632 alx60

277379641 ppriyanshu1404

277384033 Niraj_Italiya.

All of them probably cheated. I wonder if cheaters like these get detected.

add tanish-jindal to the list

I hope there is a way to report users

Afaik like half of those ppl probably cheated before (i got the cf extension against cheaters, not 100% accurate). I wonder why ppl who have cheated don't get immediately banned.

Check this account please

[submission:25653862] sugar.nova 223608021 sugar.nova 238014177 sugar.nova 238041366 sugar.nova

he copy paste many contest in past check 19th dec 2023, sept 16th 2023 , and April 14th 2024 contest he submitted in ruby and python, these are just sample please try to ban his account fast asap or make his contribution negative

Deleted

B is the stupidest problem I have seen so far. Does providing enough test cases to understand the problem cost money? I hope you guys never set a question like this again. This kind of contest ruins my whole excitement toward contests.

They don't provide too many test cases because then you could deduce a pattern. In this case it would be easy to guess that it doesn't work for n even.

I actually hated it when they included the 3rd sample into B just to soothe your nagging mouths. Do you guys ever test the inputs yourself? Doubly so when it's a constructive and the process of checking correct answer is easy?

Sorry, my bad. I shouldn't have said it was easy, but the way it was written made it hard to understand. Maybe it's because I'm a beginner, but a lot of participants faced the same problem. You can ask them.

I will simply tell you guys to stay away from keyboard, take a pen and a notebook, and do your thinking there. You all failed to sustain when problemsetters didn't overfeed like they usually do is

notan indicator of a bad problem.I did casually curse the original sample "they really did it cheeky there huh?", but the course of actions of drafting my own work only took me about 2 minutes after, and got an AC at 7:xx.

Did I stumble? Yes.

Did I resolve myself? Yes.

Did I underperform myself? Yes. (7:xx to AC problem B is slow)

Should I blame the setters? No.

I also did stumble at B but got it resolved myself with pen and paper and too hated when they added new test at B which made it super easy. It was super slow for me to solve B as I didn't understood the problem in starting which affected my rankings.

Edit: Nvm, just my stupidity.

Worst Problem E1 & E2 I have seen, can't believe there exists a problem worse than "Let Me F**k you a Lesson". Downvoted.

How do I approach C?

Use the fact that the query tells you the middle node on the path between nodes $$$a$$$ and $$$b$$$, that should hint at a certain technique.

hint 1- assume any node to be root of tree 2) — if u have any child parent pair in query than answer will either be child or parent just try to generalize this fact.

Can anyone post their solution to C. I speed ran A, B but got stuck for 1 hour and 45 minutes on C

You can solve it using binary search. I did it by having i go from i to n — 1, and then querying ? i n. Since the x node is going to be in the middle of both nodes we can now keep querying ? i x until the the middle node isn't equal to i. When it is we know that he nodes we queried are connected by an edge since the middle node is one of the nodes we asked about. My submission that has some code that isn't really useful looking back: 277383795

I was trying to do something like this, could you tell me what I have done wrong: My code

i would recommend that before the operations description in problem B say that we will chooce one of them

I think div2 is getting harder and harder

D is on obvious side than its position, but C is very cool! Thanks for an interactive which feels brand-new!

can you give hint on D

Try to solve in $$$O(N^2)$$$. To optimize it, you need to learn about some data structures. (I used set and segment tree)

i solved in O(n) without any DS, i dont think you need anything complex.

can you link your solution plz

here, if you have any questions, I'll try my best to explain the approach

thx brother

I started to think about whether my solution was actually O(n), but i couldn't really come up with a test case, thank you for the hack

You don't need any "advanced" data structures. I solved it with a map + multiset, though even a map + sorted vector would have worked.

Key observations:

If $$$x = mex(array)$$$, you can achieve $$$x = mex(array, mex(array))$$$ which is

strictly greater than mex(array).The mex of an array is always achievable.

If there two or more arrays which provide the same $$$mex$$$, $$$mex(array, mex(array))$$$ is always achievable for these arrays by achieving $$$x = mex(array)$$$ using one of them and then $$$mex(array, x)$$$ using the other.

So we can just calculate this in descending order of $$$mex(array)$$$ as long as we're careful to handle all arrays with the same $$$mex(array)$$$ together (or tie-break them in descending order of $$$mex(mex(array))$$$).

Code — 278093417

Interesting problems that require some tough thinking. Love this round!

Let's fucking go guys, can't wait for the next contest for people to sell and leak even more solutions!

Images on codeforces are retarded today, can't embed, so here's an album

https://imgur.com/a/RNHSRp4

4eRRKghr p013lPh7

So there's like at least one or two IM-GM's selling solutions right now. Understandable, have a nice day.

a gay want to destroy me?

why i get idleness limit exceeded 277414909 even if I fflush the output, can anyone help me.

same bro

When you're outputting the answer, you are missing a space after the exclamation mark ("!1 2 1 3 3 4" instead of "! 1 2 1 3 3 4"). This probably confused the system.

ohh my bad, i am sorry I will try again thank you for finding my mistake

Looking in your code again, you're also missing a newline after outputting the answer, which is probably problematic as well. Be VERY careful with output formatting, especially in interactive problems.

I was getting idleness exceeded too if I didn't do 'cout << endl'; Try printing a newline or using endl after you query. It should work

thank you for the reply I will surely try it once.

just a 2 min research

277417188 imagine working to get in IITB and then it still comes down to cheating? , 277406374, 277417238 bro really did the hardwork for converting to python lmao, 277411216 this dude interchanged for loops and while loops, 277408155

bro idk how did u find and check these submissions

i basically go into standings for the round. Then i simply look at newbies and pupils who have solved 4 that too in the last 30 minutes. Then codeforces allows you to open the submissions once the contest is over, so i check the submissions and match with the leaked ones.

I think cf should have accuse button

yeah , atleast for IMs and GMs, they should be able to accuse

Problem A felt like there was something to it, but the more I thought about it the realization came in: "Ahh.. it's just a trivial problem that was deliberately given a weird statement to confuse AI, isn't it?". It made me kinda dislike the problem, sorry.

Bad Sample Cases

I kept on getting Idleness Limit Exceeded on my Python solution to C, even though I flushed the buffers as required. Can anyone look through my solution and tell me what's wrong? SUBMISSION to C

I think that an implementation with segment tree should have worked for D. The time limit is too small. 277416972

what is the time complexity of segment tree? i think intended solution was O(n) and O(nlogn) probably passes as well.

Theoretically, log(n) for each update and query at each position, so n * log(n). Practically, I know it's a very large constant, but 2s seems a bit low for D.

the solution in tutorial is O(nlogn), so it probably should've passed, weird.

going through the scoreboard and found a bunch of similar solutions for E1. Here are just a few.

Here is one more for your collection: 277415655.

I find some of the statistics about the round... interesting.

I hate interactive questions

Do anyone know a software that have a faster execution for interactive problem?

I use jdoodles but it not stable

Screencast with commentary

Cheatforces...

Hi guys, I am very sorry for the situation with B. It was not an easy task to explain and we got lots of clarification requests during the round. I know I should not have added an example case in the middle of the round, but I felt like it was better to have everybody understand the statement (with, some may say, an advantage for people who solved B later) rather than having an unclear problem. I take full responsibility for what happened and will make sure to not make it happen again.

I think the PS for B just had the issue that I thought we had to do the operations in some order. Instead of us doing anything.

Other than that I loved the problem idea.

really nice problem C

trickI dont know if a lot of people used this but you can do a binary search but you move both ends, if the current x is already visited you move "a" and if not you move "b" until x = a 277382388

could u explain more clearly

explanationnotice this " If more than one such node exists, Misuki will tell you the one which minimises d(a , x). " this allows us to find an edge between the vis component/component we already connected and a node that we haven't connected

if you have any more questions try executing my code step by step

Today Problem C was Solved by Chat-GPT, here is the link to the convo: You can Match this to my submission, Really Disappointed by this discovery I want to report contest violation on myself and want the Testers to do better , I did this as a joke today but some people regularly use ChatGpt to solve problems upto D, This is ridiculous please make sure the contest are fair please look into it. Misuki MikeMirzayanov Ahmad_OS BurnedChicken

Really Disappointed ☹️

I am just a tester and I can't do any thing :'(

as a tester you could

testif chatgpt is able to solve the questionsThat is the reason why my standing is lower than in the previous contests

The problem itself was not too difficult. Just some observation was needed.

As usual, there are a lot of cheaters, but this time at least problems D and E require enough of implementation to detect cheaters.

Hi, i have a query regarding segment tree,i submitted two solutions for D-277405401 and 277409915,first one gives "Runtime error" and second one is accepted,the only difference between them is the memory i allocate to segment tree.

I read than size of segment tree is less than 4*(size of array) then why does my first submission fail.Any help is appreciated.

HELP!!!!cool round, had a lot of fun participating after such a long break! cheers to the problemsetters and testers! <3

Can someone tell me why I get WA on test case 3 for my solution to C: Code

Try adding

`cout.flush()`

after each cout?The problems were interesting! Thanks for the round!

Can anyone tell why my solution gave a runtime error in pretest 3?

277417034

I used the fact that if the answer to "? a b" is a then they have to be adjacent in the tree.Whenever the answer was different from a, then i would know that the path which connects them goes through another node x and therefore i would have to ask "? a x" and "? b x". I used dsu to avoid doing unnecessary questions. I suspect the dsu might be the reason for the RE but i cant spot the mistake

Can someone tell me why my submission: https://codeforces.net/contest/2001/submission/277402454 is giving a

`wrong output format Unexpected end of file - int32 expected (test case 1)`

error?It passes on everything else...

You call

`ios_base::sync_with_stdio(false)`

, which means output buffers of`stdout`

and`cout`

aren't synchronized. You should just use`cout.flush()`

, not`fflush(stdout)`

. Once you call`ios_base::sync_with_stdio(false)`

, only use`cout`

and don't touch`stdout`

.I'm a bit confused -- where do I use stdout? I thought doing cout<<endl was good enough?

`stdout`

is for C I/O and`cout`

is for C++ I/O. Basically C++ I/O is good enough and you don't need to use C I/O at all. And once you call`ios_base::sync_with_stdio(false)`

, you shouldn't mix C I/O and C++ I/O.Gotcha. Thanks. But that wasn't the issue -- I think my code was just too slow, and the error it gives(wrong output format Unexpected end of file — int32 expected (test case 1)) is how they say "too slow" for interactive problems.

`endl`

isn't slow, and it should be possible to solve the problem with it.The message basically means your program quit without printing a required integer. Maybe

`ans`

in your code can be empty and your code prints just`!`

without numbers?I'm not saying endl was slow -- I was checking a bunch of things. Once I deleted that code, it passes.

Thanks Misuki ,Really enjoyed solving c problem. but i am suprised so many people solved it. Too much cheating

For someone looking for an elegant implementation of problem C,

My CodeThe idea is to fix 1 as the root. Then we need to find the parent of every i(2,N).

The observation is that every time we query(a,b), x points to the midpoint of (a,b). This gives us the intuition of binary search considering the number of allowed queries. An edge exists from (a,b) when query(a,b)=a.

The above observations are sufficient to solve the problem.

thanks for ur sol, it's clearly visible

Can someone please explain why is it failing on test case 3 (wrong output format)? I basically check for valid pairs of nodes, and return when a from query equals the nearest node.

`[submission:277424402]`

The data of D is too weak. Some people passed it by going through every value each time, which can have a complexity of $$$O(n ^ 2)$$$

can you send any link please ?

my solution runs in O(n^2) with good enough hack

it's because of the l=tren+1 line I think you while loop isn't really running for n only it's running for more

In problem C when I use fflush(stdout); I got "Idleness limit exceeded" but when I use cout.flush(); it gives correct answer. Why? I used language "C++20 (GCC 13-64)". 277431865 277431666

I'm not sure, but I reckon it's because you used

`cout`

for output.i think fflush(stdout) is for printf, im not sure though

Only at upsolving I realized I was so close to AC E1. I somehow tried to calculate the losing side by pure power instead of stars-and-bars, and scrambled my hair at why test 2+3 was WA. What an idiot I was.

AC upsolve: 277433539 (

UPD:changing to a cleaner/no-debug code)Kudos for the round, it was nice. I wish I could see more from you soon.

I'm doing the same thing, but I can't understand why the losing side needs stars and bars, can't I pick any node from that subtree for each operation?

You got it right, but the stars-and-bars are to correctly count them.

What you should count is basically "for a complete binary tree of $$$2^i - 1$$$ nodes, how many distinct heaps are there after adding $$$k_0$$$ operations into it". Since we discern by heap values, $$$\left( 2^i - 1 \right) ^ {k_0}$$$ is obviously wrong.

because each operation is indistinguishable, so you should use star and bar to calculate it (i.e. the number of ways to put $$$a$$$ indistinguishable balls into $$$b$$$ distinguishable slots). $$$b^a$$$ is used to calculate the number of ways to put $$$a$$$ distinguishable balls into $$$b$$$ distinguishable slots. And it's important to think the objects are distinguishable or indistinguishable in counting problems.

The data of problem D is so weak that someone can solve it by solution of O(n^2);

As the guy that got 4th I just now realised my solution to D runs in O(n^2) :skull:

As a guy who got expert because he solved D, same lmao

277408206

This submission by user rajneesh_neo clearly seems to be faulty ..

it clearly has been copied from 277400319 by user keyur14113

using some AI tool , just the variable names have been changed.. rest of the structure remains exactly same..

Kindly look into this MikeMirzayanov

Please can someone help me with why I'm getting

`Idleness limit exceeded`

for this code?Yay !! Thanks for the interactive problem authors..Hoping to reach cyan in the next contest

I am a newbie .. i did only one question in this contest and that too correct but i lost -31 .. can anyone tell how ?

Your Rating depends on your performance on that given contest like if you performed like a 800 you would certainly get a positive rating but if your performance is less than your current rating then your will lose some rating .You can Calculate your performance by seeing the number of submissions on a given problem like for today's contest Many people solved the A problem so to get a positive rating you must solve problem A fast or solve at least 2 aside from that there is an extension called carrot try using that it does a great job predicting the rating changes..

Happy Coding !!

Thanks got it got it .. thanks ;

One more Thing you seem to only solve problems of 800 rating but I would suggest leveling up a bit because that will not be enough to solve the B of div 2 which is bad in a long run so do try out problems of rating 900 or 1000 more...

Can anyone tell me why my code for D got accepted with time complexity of O(n²)?

Is there any data could hack my solution: 277446088?

Thanks, I see it. It seems like that it is easy to find such data.

Can someone tell me,Why i got 40+ in last contest even though i didn't attend able to do 1st first in time? AND why i got

only15+ from this contest by only solving 1st question??As a newcomer, you have 1200 hidden initial ratings, divided into the first five contests sent to you. If you don't perform well in the first 5 contests, the rating sent to you will be reduced, but you will not be given negative ratings. The following contests after first 5 contrsts will directly settle your total rating. So all in all, instead of going up to 783, you're going down from 1200 to 783.

Previous div 2 round : solved 2 problems with no penalty -> rank 5157 This div 2 : similarly solved 2 problems in similar time with no penalty -> rank 11650 What happened here lol

in my case: Past div2: rank 11000 with solving 2 problems This div2: rank 6000 with solving 2 problems in similar time lol

same

it seems that div p1 + p2 only solvers are quite alot so a small margin of times makes a big change in ranking.

in problem c why it was not mention tree has n--1 edges exactly i struggled a lot like 30 min

A tree of $$$n$$$ vertices always has $$$n-1$$$ edges. This is basic knowledge, no need to mention upfront.

thanks

the worst problems set that i've ever seen

Really nice interactive problem,which made me -152 :(

Can someone tell me where am I failing,my max no of queries are less than 15n but I am failing. My logic is somewhat similar to editorial Here is my solution 277462404

I submit twice on problem C.the first one at 00:38:35 and the second one at 01:51:32.The first one get skipped and my ac time become the second one?? I dare not to submit twice again...

Do not resubmit in normal rounds unless you have high doubt in your previous solution. But you can resubmit as much as you want in Educational, or Div. 3/4 rounds.

I didn't use fast IO in the first solutioin so I want to see how fast it will be if I use fast IO... I will not resubmit anymore. Thanks for the explaination.

C was insanely good. Kudos to the authors!

ORZ

Misuki orz

strongly agreed .

My solution 277403863 for the problem 2001C(aritg). I had done the question earlier than the second person whom I don't know. So, why did I get that it matched with someone.

I have been informed that my solution for problem D matches with many others . I don't know how it happened but I want to clarify that my solution is completely my work . So, I request you to look over my situation in this . Also, on codeforces it is happening to me for the first time.

I have been wrongly accused of cheating even though my submissions our genuine. I request to look into it and make way for my truthful submissions. This is the first time it’s happening to me and also I have submitted the solutions earlier than the other persons.

277406374 277391758 really?

yes really

Me: lets try to become specialist

CF: final rating= 1399