Пожалуйста, подпишитесь на официальный канал Codeforces в Telegram по ссылке https://t.me/codeforces_official. ×

Блог пользователя Poseidon913

Автор Poseidon913, история, 6 лет назад, По-английски

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

  • Проголосовать: нравится
  • -4
  • Проголосовать: не нравится

»
6 лет назад, # |
Rev. 3   Проголосовать: нравится +1 Проголосовать: не нравится

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.