Poseidon913's blog

By Poseidon913, history, 4 weeks ago, In English,

Please, can anyone explain the Problem B "996B — World Cup" of Codeforces Round #492 happened on 24/06/18. I couldn't completely understand the explanation without any solution code provided(like it used to be in previous contests.)

 
 
 
 
  • Vote: I like it  
  • -4
  • Vote: I do not like it  

»
4 weeks ago, # |
Rev. 3   Vote: I like it +1 Vote: I do not like it

Suppose you have the numbers A(1), A(2), A(3), ..., A(n)

What is the length when you visit them in round 1 ?

A(1) — 0, A(2) — 1, A(3) — 2, A(4) - 3, ..., A(n) — (n - 1)

You visit queue i at size A(i) — (i - 1) in round 1

After that notice if you visit a queue at size t, you also visit it at size t - n, t - 2n, t - 3n, ..., 0.

Now, how many visits do you make at a queue when it is 0 ?

The answer is t / n = (A(i) — (i - 1)) / n

So, for each queue calculate the time it will take to reach it and keep track of the minimum.

Here is my code.