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

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

I didn't understand why the method mentioned in the editorial works. Can someone provide me with a proof for why it works?

Question : 357B

Editorial Solution :

Let's process the dances in the given order and determine the colors of dancers' clothes. If there are no dancer from some previous dance, we can give the dances different colors arbitrarily. And if there is such dancer, we already know the color of his clothes. So, we arbitrarily distribute the other two colors between the remaining two dancers.

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

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

It's guaranteed that each dance will have no more than one dancer that participated in a previous dance, isn't it?

So, in any dance, when we see one of the dancers danced in a previous dance, we will be sure that the remmaining two dancers are new, and they haven't had clothes yet, thus we give them two different colors that also differ from the color that the old dancer had.

And when we see that all the dancers in a dance are new, we give them the colors in an arbitrary order, and declare that they become old from now.

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

    Thanks fam!

    Lol I misunderstood the question and I thought consecutive dances should not have more than one dancer in common.

    I should really stop thinking about sequences :)