**Pay attention to the unusual round start time.**

Hello, Codeforces!

Codeforces Round 935 (Div. 3) will start at Mar/19/2024 11:05 (Moscow time). The problems are expected to compose an interesting competition for participants with ratings up to 1600. However, all of you who wish to take part and have a rating of 1600 or higher, can register for the round unofficially.

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**.

You will be given 8 problems and 2 hours and 15 minutes to solve them.

Note that the **penalty** for the 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 point of 1900 or higher in the rating.

**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.**

The problems are based on **VKOSP.Junior**. Authors: Kirill_Maglysh, NToneE, Gadget.

We would like to thank:

Vladosiya for coordinating the round.

nigus, Gheal, KKT_89, Noinoiio, systy, FBI, SiERic, moonpie24, nik.danilov, SashaT9, Pa_sha, FedShat, an_na, khaser, Ghevar, Boris_Ber, PUFL, blook, yakuri354, iluminat_Btopou_AkkayHT for testing.

gurovic for improving the quality of the statements.

MikeMirzayanov for Polygon and Codeforces platforms.

Всем удачи!

**UPD**: Editorial is out

Auto comment: topic has been updated by Kirill_Maglysh (previous revision, new revision, compare).Different start time.

Thanks! Added to the announcement

Pay attention to the unusual round start time.,hmm but whyyyyy, dont we deserve a reason -_-The round is based on an onsite competition mentioned in the announcement, which, unfortunately, could not be postponed to the usual round start time :/

my bad i didn’t notice, thanks

Yay! Div3 Round. Note the unusual time!

Spoilersame =(

You are right ... but why not thank me for participating ?

As a tester, I tested some tasks

It's on my birthday!!! But I have to go to the school ... T_T

I see you are from china.It's astonishing to know that you are CM and still going school lovely_cyc

Hope to bring my rating back after this round

Good luck for everyone!

Agree with you

why such an unusual time?, it's hard for lot of participants to be able to give the contest at that time :(

if i dont submit anything or may submit the first one,will my rating fall?

If you do not submit anything.Your rating will not fall.

Any submission results in a rated contest. It won't be rated if you did not make a single submission tho, even you registered beforehand

ㅤㅤㅤㅤㅤㅤ

Why is the timing so unusual? Problemsetters please try to hold contests in the regular times only as it's really inconvenient for people studying in universities(as most of them are students) and it's quite difficult to make it on a weekday on such an odd time.

CF Round >>> School/University 2hr lecture

Definitely, but low attendance == repeat course == :(

make good friend == do proxcy == problem solve

College uses biometric attendance machines == cutoff thumbs to give to friend for proxy == slow typing speed. Problem created.

1hr contest reset 1hr mid semester exam

maybe the olympiad will be hold at the same time

as a participant of the olympiad, it is held at the same time

I want to author a Div.3 , how I can do ? Vladosiya

If someone register above 1600 rating then will they get Negative rating?

if someone has rating 1600 or higher, he/she can register for the round unofficially and the rating won't be affected.

Very poor timing

What an unsual time! Maybe there will be less participants than usual days orz.

Cf round >>>>>>> school

[Deleted]

I can solve atmost 4 to 5 in Div4. Unfortunately can solve only 1 in div 3. Hope B to H will be very hard.

Sleep schedule ruined enough to the point where a 1 AM contest will not affect my mental state. Good luck to all my fellow competitors, and may you gain a cool new color!

Time would mess up my sleep schedule. Good luck to all my fellow contestants. It's hard for me to be able to give a competitor at that time :(

Wishing everyone a great round and a positive delta !

I appreciate the unusual start time, much more convenient for me since contests are typically at 2am for me. You guys should do this more often :)

Is this site VKOSP.Junior is available in English?

I am excited about Div3 but this time wont allow me to participate

School Time here in China :(

School time at 4:00 pm :skull:

(I hope that the school starts late right?)

If you see 7:30 a.m as an late time, then you are right.

:skull:

speedforces!

Thanks for this "unusual time". In the month of ramadan this time is perfect for me( from Bangladesh)

also in Iran. for the usual timings, Iftar is at 18:30, and the round is at 18:05. it was really hard

That's really difficult!

fun fact!

today is the last day of the persian calendar (I guess it's called new years eve)

so, if the round was at it's usual time, most of persian users couldn't participate, so thanks for this

love from Iran, Happy nowrooz <3

Ok ali

How the hell did u know my name :||||

With patience and faith

maybe for that reson that both of you studying in the same school ?!

Damn! That’s right. He’s probably one of the 10th grade students

What an unusual start time! But it's suitable for Chinese students.

OMG , being in the class, I did not know at the end of which.

great questions, but I wonder if problem setters intentionally make div3D easier than div3C most of the time. Problem C took way too much time to understand and implement.

How to do D ?

DP

Why DP if greedy works?

Assuming $$$f(i)$$$ is the minimum cost to stand at exactly position $$$i$$$, we have $$$f(i) = a_i + \sum_{j=i+1}^{n} min(a_j, b_j)$$$.

The answer will be the minimum of $$$f(i)$$$ under $$$1 \le i \le k$$$. All $$$f(i)$$$ can be calculated through a linear iteration of the array from $$$a_n$$$ back to $$$a_1$$$.

Nice solution, I tried to think in greedy way for some time and then gave up and settled with DP

At this point I don't know if this solution of mine is classified as DP or greedy :D

Kinda a mixture of both, DP in the way speeding up the calculation, greedy in the fact that $$$a_i$$$ and $$$b_i$$$ can interchange freely in the background without damaging the solution's validity.

while i > m, if a[i] <= b[i] jump to i

then find i <= m, with minimum cost of jump

Announcement for C was given only after I asked about n/2 being floating point number. Explanation could have been better, wasted so much time in C due to that

But overall problems were good. Not too easy. Even A and B required some math work.

Problem Statement of B and C was not good. Especially C

Unusual timing and kinda tough.

C makes me want to broke my keyboard.

same qwq

In java,

SpoilerMath.ceil() isn't very useful sometimes!

problem C showed me how i suck at indexing

I can't do indexing without visualizing it every time like no matter how many time I have done it before, I have to draw , so maybe this can help you I think that its either you draw and figure out the index things or you memorize them

how to E

Follow the given algorithm strictly and at last swap positions of l and x's index

Why this works can you give idea or intuition

At all mids,

If p[mid] <= x, l=mid else r=mid;

So, basically you have to find what is the last index where l was updated.

and in some cases, l may not be updated at all, there after simply swapping the l's position and x's position will make your array valid.

please, bro, explain me : when the last ind you updated is greater than target and in between the process mid come to our target. now if we swap last ind and target then mid again comes to the last ind and moves in the wrong dirn because initially the num is =target but now it it > tar. in between my code got accepted without thinking this how i am still confused.

From my code,

https://mirror.codeforces.com/contest/1945/submission/252251419

I will not actually swap them

First I will let this loop run

where my l is getting updated only if p[mid-1]<=x

ll l=1,r=n+1;

while (r-l>1)

and now after breaking out from them loop I will not care about the r. I will only think about the l.

Now if l == target's index then no problem else swap is required

so the answer will be

1 l target's index

case 1: p[l] <=m (getting l after running binary search described in problem) then if we swap and run the binary search again . mid goes to the same values and we get our tar at l.

case 2 : p[l]>m we are returning the ans as swapping final ind and tar. problem : if mid goes to the ind of tar (now a bigger num is present) then our binary search is not same as our initial binary search.

why this still give accepted verdict ?if lo is changed from 1 then it always goes to num<=tar , if mid reaches larger num then hi will take the place of larger num . therefore either lo is getting no<= tar or it remain at 1 , if it remains at 1 then still our approach worksnow I got this last part(why does this still give an accepted verdict ?), if I am wrong somewhere please correct me. thanks bro for help.

Repeated this process until found a solution:

Please tell about it here https://mirror.codeforces.com/blog/entry/127381

ㅤ

C was implementation heavy....

before the edit, there were multiple solutions that they didn't accept.

I did it after the announcement

Ignore this comment. Deleted the tutorial, will wait for open hacking phase to complete.

god is back

Got the idea of problem E in just 10 minutes and the rest of the time passed just doubting myself that it cannot be this easy!!!

sorry to say, but the worst div3 statement i've seen in a while. It's just a troll if you don't have even the basic knowledge of english and you just set a problemset with whatever you want. Just a waste of time

agree

problem C was so hard to understand, atleast for me

Requesting to launch more contests on this time during the Ramadan! It becomes hard to attend the contests in the regular time during ramadan!

B,C and H are the most awful problems ever.

What's wrong with them?

worst div3 ever seen

What an Extraordinary, Mind blowing Fantastic steps!! Tutorials please, Sir tickbird.

Skill-issued bird. Why don't you comment from the ac that part in the contest?

" had to use std::lcm for some reason, waste hour and 4WA until realize overflow :( "

?your altjinsu

good Python job

statement of c was not clear at all

Man B & C was laden with the weight of implementation intricacies.!!

I beg to disagree. I would say that B and C are somewhat odd than usual, partially wordings, partially mathematical involvements, but implementations for them are nowhere near intricate.

Master, are you taking my comment personally? You see I am not as skilled as you Master. I am a newbie in Codeforces parlance. So I'm not as good at simple thinking & solutions as you are, Master.

Firstly, I think I should apologize if my words somehow felt like a personal attack. I never meant it that way.

Secondly, however, I do think my point still stand. Of course, there will be an observable bias coming from me, with more experiences around. However, I do understand where you are coming from to counter-argue, as I had been there (or so I thought).

For the problems themselves, B is a straight-up math problem, and C literally asks you to do whatever it tells you to.

Of course, it's not that easy at a glance for newcomers: B's nature might seem dodgy to code at first thinking of how to fit the timespan, or is it required to explicitly define the optimal timespan; C — for now we ignore all the problem statement issues — looks confusing for newer contestants for maintaining the left and right side of the split.

Still, what I wanna say to defend my point is, it's possible, and very likely, to generalize and abstract your thought process for a clean execution. The mathematical nature of B makes it a three liner if you understand how the math works, C is much cleaner to code once you could visualize how the states of the two sides change when we move the boundary.

Of course, you don't have to take my thoughtstreams above all at once. One thing, you need to develop your own. Another, it's a steady learning process. You'll get better the more you spend your time thinking and improving. For now, I only state what I did at the original comment, as an opinion that what you have witnessed in your experience is incomplete — I won't say mine is already complete and perfect, but at least today I could cover yours a bit.

Is it just me or today's G and H are worth Div2E at least...?

I was quite close to clear G, but cannot really make it — I thought it was just simulating the process but the initial queue order screwed me over.

I guess G was pretty tough considering jiangly took almost an hour to solve G

Definitely, clist rates G at 2593 and H at 2766.

Holy hell, no wonder....

It's nice to hear that, since I solved H in the contest. But my solution was so simple that I think the difficulty of H will be at most 2200.

UPD : I have posted my solution in this comment.

I think you don't understand how problem difficulties work.

I do, div3 problems get a lot of time after the contest before they are assigned a difficulty, there were a lot of problems in this contest and so most of the people could not reach H. I think in 2-3 days, it will have more than 400 solves (and of expert — CM range people (that's how problem difficulties work, right?)).

https://mirror.codeforces.com/blog/entry/62865?#comment-468443

Oh, I haven't read that.

I have read this blog though https://mirror.codeforces.com/blog/entry/126799.

I don't know if its a special case that if nobody solves the problem during contest then after the contest submissions are also considered (I'm talking about the 1919H case)

can u explain ur solution for problem F?

Maintain an ordered set of shrooms with nonzero magic power. There are two operations: remove a value and find k-th maximum. ordered_set supports both in logarithmic time.

https://mirror.codeforces.com/contest/1945/submission/252233278 Where is my C wrong, can anybody pls help

https://mirror.codeforces.com/contest/1945/submission/252278560

made changes in your while loop got accepted

Cant see the submission.. i think u pasted wrong link can u check pls

done

Can u pls tell why my code is wrong when i handle the extreme cases seperately and also in one of my later submissions i used 2.0 but still WA https://mirror.codeforces.com/contest/1945/submission/252266880

you are making it too much complicated while checking outside loop

How did you solve F?

i thought it's a ternary search...

Basically, you do what you are told to greedily.

Loop through all $$$k$$$ that satisfies $$$2k - 1 \le n$$$, each $$$k$$$'s answer will be the $$$k$$$-th largest element over the unaffected indices multiplying by $$$k$$$ itself.

To maintain the elements properly, we can make two BSTs (or more regularly streamlined in C++ STL as

`std::multiset`

), one for the available elements, one for the already chosen one. Choose the largest element from available and throw it to chosen for the act of taking mushroom, and erasing element from either multiset (prioritizing available over chosen) for the act of "cursing".My implementation, for reference: 252244274

Thank you

Can you tell what is wrong in my solution? This is my solution for F.

Can't tell at a glance, but if your

`it`

iterator is meant to get the max value around, is it a little bit too dangerous to let it "hang" around with all those multiset insert/erase calls?Maybe consider renewing it every time you need it. I don't yet see any other suspicious code, but stay alert while debugging.

How is the ans for the third test in problem F "8 2". Shouldn't it be "6 2"?

we are picking mushrooms with strength {4, 5}, min = 4, and there are 2 mushrooms so ans = 4 * 2 = 8.

Honestly, I was irritated due to very less or no notes in any of the problems.

Ramadan Mubarak Brother. I got it.. thanks!

why in C in "101" answer is 2 but not 0?

1.5 — 2 < 1.5 — 0, 2 is the closest index possible to middle

The authors are not at all adept, and could not write that n/2 is not an integer division.

Yes, They could have simple mentioned n/2 it was decimal division. But other than that, the problem was written in a confusing manner and was lengthy, we cant blame them for that.

a lot of people solved b : (m * 2 — m) / a + (m * 2 — m) / b + somethings and no body will know why LOL

pattern recognition from test cases

how to guess (a/m) + (b/m) + 2.

it's so hard

try this m=m+1 and then ans= ceil (m/a) + ceil(m/b) ,it will be the answer Reason: Consider the [a,a+m] and [b,b+m] to be included by incrementing m.

tq

https://imgtr.ee/images/2024/03/19/8f04bf5b44e908e9eb17be606d4e3021.png

this is the second test case in the first sample

the first line for the first installation

and the second line for the second installation

just notice that in the first line the fireworks firing at time 3 will end at time 13 so any one which will be fired before or with in the 13 is included

that's how I figured it out I hope it helps

thanks

The number of fireworks from an installation at any moment first increases and then becomes constant. The sum of these constant values from both these installations is the answer.

This constant value from first firework is equal to (m+a)/a and from second firework is (m+b)/b. You just need to sum them.

Can anyone give me intuitive understanding that why Following the given algorithm strictly and at last swapping positions of l and x's index is correct for Problem E?

Consider 2 cases, whether the target is among the elements visited by binary search.

If not, we can just swap the last l index with the position of the target since that will not change the search sequence itself.

If yes, we see that swapping the order of any p[m] <= target will not affect the search sequence, since we are setting the left limit regardless every time.

Still not understood the Yes part. Can you please Elaborate.

If $$$p_m \le x$$$, assign $$$l = m$$$.

Say we pick two indices $$$i, j$$$ from the visit sequence such that $$$p_i \le x$$$ and $$$p_j \le x$$$. If we swap $$$p_i$$$ and $$$p_j$$$, will the visit sequence change?

To add on to this, if $$$x$$$ is in the search sequence and is not $$$p_l$$$, then on the final time we set $$$l$$$, $$$p_l < x$$$. We can apply the previous statement to these two indices.

What if a[l]>target and target is visited ? In that case, search sequence will be altered ?

p[l] can only be larger than target if we have not visited target, since we only set $$$l = m$$$ if $$$p_m \le x$$$.

I used this logic during the contest and got WA on test2. Did your solution pass ?

I looked at your submission and I think you calculated m incorrectly. I submitted your code with this change

`ll m = l + r >> 1`

and it passed. link

Generally, you would do

`l + r >> 1`

for calculating m, but to avoid integer overflow you can do`l + (r - l >> 1)`

.Yeah, you are right. Unlucky me. Thank you for your help.

The 'm' value that you're talking about should not be visited as mid value in the Binary Search, Right?? So we have to pick that index 'm' that is not visited during the binary search as well as it satisfies the condition p[m]<target.

How are we sure that one such m will always exist???

The m I am talking about is the m in the problem statement. If we visit the target index during the binary search, we can always switch it with the last time we set l (see logic in previous comment).

First I assume that you are saying why this works, swap(1, position(x)) and then swap(1, l). or n instead of 1.

Solution with 2 swapsConsider the process of binary search. It goes to mid then maybe to right or left and so on, let's say we marked these positions where our mid went. Now, binary search will stop somewhere, why don't we just put x on the last l? because x might be somewhere that our binary search marked and when we replace it with the element at last l, it might change the sequence of our binary search, and then our replacement will not make any sense. But, what can we do is that we first put x at position 1 (or n). What will happen is, either it is itself last l or it does not occur in our marked positions. In both cases we are happy, now we can just swap(1, l).

UPD : Now, I get your question, my friend also told me this solution.

Solution with 1 swapIf x did not occurred in our binary search sequence (marked indices in the first solution) then it's easy to see that it will work.

Now, x also occurred at some position. All we care about is about the property that a[mid] <= x, when we came at the position of x we said that ok a[mid] <= x (actually = x) and then we went beyond to some other positions after that, but now if l was moved from the position of x, then the new positions it moved through were also <= x. So, when we swap(x, a[l]) then the properties does not change. The elements from which l passed through are still <= x. Hence, this solution works.

Thank you for the two-swap solution. I was wondering why two swaps are even allowed when it could be solved with at most one swap so easily. I thought it was meant to mislead us, haha.

252273129 It is the solution for Problem D.I don't know why I'm getting wrong answer on test case 3,jiangly approach and my approach is same even though I'm getting WA.Please help me to find the mistake.

You defined

`int`

as`long long`

, however`INT_MAX`

stays at its original value i.e. $$$2^{31}-1$$$, which might be smaller than the actual maximum possible answer of around $$$10^{14}$$$.Thank you very much sir :) my solution got AC.

Contest authors:half of the time has gone for reading....

💯

is the Special Judge right?

$$$p_l$$$ may be $$$3$$$ at last.

UPD: I'm sorry. I was wrong, $$$p_l$$$ is 4.

can anyone tell me how to find the interval of size m where maximum multiples of a and b are present?

both fireworks will be launched simultaneously at LCM(a,b).It is always optimal to take the interval from lcm(a,b) to lcm(a,b)+m inclusive. in some cases lcm(a,b) will be greater than 1e18. but intervals lcm(a,b) — lcm(a,b)+m and 0 — m+1 will have same no.of multiples of a and b. so answer is (m+1)/a + (m+1)/b + ((m+1)%a != 0) + ((m+1)%b != 0)

why m+1 ? why not only m?

just increase 1 just after dividing m/a works, but i don't understand how m+1/a works, can you elaborate ?

As per the question range is given as x,x+m inclusive so there are going to m+1 numbers irrespective of whichever range we take. Then we are finding multiples of a,b in those numbers

I did not get how 1 + m/a works

Overall didn't enjoy the contest. Problem A was ok, for B I didn't like the method. A and B could have been swapped. C was horrible, I had to read the problem statement 4-5 times. There was some clarification about not rounding up n/2 was weird. I feel you were going for a heavy implementation round to make the problems more difficult, sadly I am not a fan of it. D and E were smartly designed and I have fun solving them. But for E, I didn't like how I had to put seed values as 1 and n+1...like I spent 20 mins to figure this out, which I felt could have been improved.

What is done is done. Thank you for the contest! I appreciate your efforts for the round <3.

https://mirror.codeforces.com/contest/1945/hacks/1006163

~10 mins after the contest was finished, I realized I forgot to handle one case lol. This submission should fixed it. Anyway, my screencast is still processing and will be available here.

Orz

Orz Sir!

Hello could you give me the case which you used to hack your solution?

for D just a easy greedy! XD

Bro sent the code as a link or spoiler

sorry about that v~v

https://mirror.codeforces.com/contest/1945/submission/252311475

TLE por el cerr

sad f y

This contest was an undercover div 2.

reading >>>> div1

In D-Question, (considering 1based indexing), how does taking the sum of indices m+1 to n inside the min variable actually matter?

My code(give WA on tc3) Code

Correct code Code

By just taking the ans variable out of that min part and directly adding, problem gets fixed I get it that it is more simpler, but I want to know why taking it inside the min part gives problem. Thanks in advance for your help.

i think it is because of the INT_MAX. You should have used 1e18.

Yeah got it, thank you.

either bro is too smart or bro is alt id of MikeMirzayanov

check this out

Any small hint for e pls :)

In C, n/2 is not an integer division could save my 1.5 hours

same lol 2 hours and 1 wa still didnt get

My bad I didn’t notice, thanks

Why did you decide it's an integer division? Skill issue

Problem E (Binary Search) Video Editorial : (Audio : Hindi)

YOUTUBE EDITORIAL LINK --Click Here

it should have been 2:30 or 3:00 Hours contest , 2:15 wasn't enough

Does anyone know why my approach for G is incorrect? Basically I'm using a priority queue to check whether there's someone who already ate with higher priority than the current front of the original queue. I take the appropriate first guy and then schedule its insertion to the priority queue. I'm taking into account order of insertion when multiple ppl are to be inserted at once so idk what's wrong.

https://mirror.codeforces.com/contest/1945/submission/252292126

Nvm I'm stupid

What an unusual start time!

H problem hint please:

i concluded that its enough to choose 2 elements for gcd and rets n-2 for bitwise and.. not able to proceed further.

I've added hints for H :

GCD is Greateron CF StepFact : we only choose 2 elements for gcd.

ProofWe can say if we pick more than 2 then we can just shift them into AND and then it will be better, since gcd will increase or stay the same and AND will decrease or stay the same.

ThinkHint 1Now, think how can we use this that all of n — 2 numbers are in AND and only 2 in GCD.

ThinkHint 2When we pick

2numbers for gcd, how does it effect the AND?ThinkHint 3Think about cnt[bit] = number of elements which have this bit off.

ThinkHint 4What happens when cnt[bit] > 2? What happens when you pick 2 elements along with this condition?

ThinkHint 5It will be off in our AND, no matter how we choose 2 elements for gcd. Now, what to do if cnt[bit] <= 2?

ThinkHint 6Think about brute force. How many numbers are there which are troubling us (not making our AND determinable)?

ThinkHint 7only 2 * LG, since cnt[bit] <= 2, then those are troubling us. We just check them by brute force. After this, we will never put them in our GCD. What now?

ThinkHint 8Is our AND determinable now?

ThinkHint 9Yes, if cnt[bit] > 0, then this bit is surely off, otherwise it can't be off (since all of the numbers contain this bit). Now our problem is just gcd(x, y) > X (where X = fixed_and + x).

Complete Solution

I haven't implemented this yet, but I think it should be fast enough:

SpoilerFor each integer $$$1 \le x \le M,$$$ construct a list of numbers in the array which are divisible by $$$x$$$. Then, for each $$$g$$$ from $$$1$$$ to $$$M$$$, solve the following subproblem:

"Given a nonnegative integer $$$k$$$, choose all except two integers from an array $$$b$$$ (which in our case is the list of integers constructed for $$$g$$$), so that the bitwise AND of $$$k$$$ and the integers is minimized." We can solve this by going through the array and choosing one element to not take in $$$\mathcal{O}(\text{size})$$$ time, and each time going bit-by-bit to determine the optimal choice for this particular bit. I'm not sure if this is fast enough, but constant factor is probably not bad because it's just bit operations.

statement for problem B was very bad and problem C has a problem in the first sample, last test case, if you output 4 it should be correct but its saying wrong the answer should be either 0 or 4 I think but I reformated my code to check for the 0 case first

No, It is stated that you have to print the least no if the difference(n/2-1) is equal.

Least of 0 and 4

in problem C: i have read the statement 10 times and i am still confused why in 4th test case answer is 3 and not 2

testcase ->

000

omg on each side never mind I thought half of the residents in total should be satisfied!!

I made the same mistake

252362491

What is wrong in this solution of problem F?

Can anyone explain ?

I had the same problem.

See this case:

The answer is

`10 2`

, not`14 2`

.That's because we remove the elements with

indexes$$$p_i$$$, like, choosing $$$k = 2$$$ mushrooms, the magic of theelement with index 3will be zero, because $$$p_1 = 3$$$, so the array will be:It's not the one with index $$$1$$$ or the element with $$$p_i = 1$$$, it's

`v[p[1]]`

.This is so confusing, the samples don't have cases like this and the notes don't help.

Honestly, the problem is good, but I don't know why doing these things just to "overcomplicate" a problem. It's not harder, it's just boring.

Dear Codeforces Moderators,

Thank you for bringing this issue to my attention. I would like to address the concern regarding the similarity between my solution and those submitted by other participants.

I want to assure you that I did not intentionally violate any rules or attempt to copy solutions from other contestants. As a beginner on Codeforces, I have been working on developing my own coding templates and algorithms to improve my skills.

I acknowledge that unintentional leakage or accidental similarities can occur, especially when using common coding practices or templates. I have been working independently to solve problems and have not accessed solutions from other sources during the contest.

Unfortunately, I am unable to provide conclusive evidence to explain the coincidence in this case. However, I assure you that I will take this incident seriously and take steps to avoid similar situations in the future. I understand the importance of maintaining the integrity and fairness of Codeforces contests.

If there are any further steps I need to take or additional information you require, please let me know. I am committed to upholding the rules and guidelines of Codeforces and will cooperate fully with any investigation into this matter.

Thank you for your understanding and consideration.

Sincerely, Nuredin Bedru

When will the ratings be out?

Is system testing done?

i think yes

I didn't get B. If both are starting at the same time, then ans should be infinity. Can somebody explain.

That would just be $$$2$$$ simultaneous fireworks. $$$a$$$ and $$$b$$$ are at least $$$1$$$ so two fireworks of the same type would be at least $$$1$$$ minute apart, rendering them unable to stack indefinitely on top of each other i.e. we always have a finite answer.

sorry bro, i didnt get. Could you please explain with an example. for example 1 1 1.

In this case both will fire at 1 min then again 2nd min and it will go on. And they are visible for 1 min. So it should be inifinity.

The problem was about what is the maximal possible amount of fireworks visible at

onemoment. Also for any a and b, both fireworks will start simultaneously at lcm(a, b).ok, that was too confusing... Thanks

Every problem statement is comparatively large. As a South Asian, I had to struggle with it. :)

By the way, I enjoyed the problems <3Imagine getting hacked for not commenting the debug statements.

Codeforces definitely needs an option to redirect stderr to /dev/null.

How long does it usually take for rating changes to come, and why is it taking so long for this contest's rating changes ???

Because of the large number of participants in Div. 3/Div. 4 competitions, system testing takes a lot of time. And these types of contests have a 12-hour phase of open hacks.

Please be patient as the user ratings will not be updated until the system testing is complete, which usually takes 1-2 days.

Nowadays, Codeforces is taking quite long time for rating updation!

I had a solution using binary indexed trees for problem F. But for some reason the case with single value is processing weirdly. https://mirror.codeforces.com/contest/1945/submission/252426399 I have added comments to debug, for the case 1 , 1 ,1 output is coming as 2. can someone help on this ?

Igonre, I found the issue

Can somebody tell me the approx rating of all problems???https://clist.by/problems/

Wow, that's a 100 rating increase!

https://mirror.codeforces.com/bestRatingChanges/13072503

Where is the solution? Sorry I couldn't find it

standard question

Problem D: Did anyone get stuck at Q2: 4663rd test case? How did you fix it?

Can someone explain what is wrong in my submission of Problem F ? 252497347

Can someone explain why I got my rating decreased after submitting a code that got approved?

I am quite new in the platform,can anyone tell me even though I submitted 2 answers and both of them got accepted why did my rating not changed ?

I have used ideone.com compiler to run my code with public access so this may be the reason for my code to be found same. I will use another compiler with proper safety in future contests.