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

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

Hello Codeforces!

You are invited to participate in a New Year's contest hosted on DMOJ. The contest begins at Jan 4, 2pm UTC, and will be open for a 36-hour period. The contest will have 8 problems written by Eliden and myself, and you will be given 4 hours to solve them. For further details, please visit the contest page.

Happy new year, and good luck!

UPD:

The round is over. Congratulations to the winners:

  1. ksun48
  2. Lewin
  3. LoneFox
  4. TLE
  5. kyleliu
  • Проголосовать: нравится
  • +81
  • Проголосовать: не нравится

»
6 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Auto comment: topic has been updated by r3mark (previous revision, new revision, compare).

»
6 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

How to solve C?

  • »
    »
    6 лет назад, # ^ |
      Проголосовать: нравится +13 Проголосовать: не нравится

    Let dist(x) be the current distance from a1 to x. If adding the edge [ai, bi] reduces the value of dist(bi),  we push the pair {dist(bi), ai} to the corresponding vector for bi. After doing this for i = 1, 2, ..., n,  we can construct the answer by starting with bn and looking for the pair with first element dist(bn) in the vector for bn. The second element of this pair is the second to last node on the path. Letting this node equal p,  we can continue by searching for the pair with first element dist(bn) - 1 in the vector corresponding to p, and so on.

    Code