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

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

how are we supposed to solve this problem?

https://www.codechef.com/AMR16MOS/problems/AMR16J

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

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

Each balanced parenthesis sequence can be reduced to an equivalent nim piles using the following rules. Let *A denote the nim value of balanced sequence A. *() = 1 *(A) = *A + 1 *AB = *A ^ *B So just find the nim value of the given sequence. If it is 0, then it is a losing position for the first player, else winning. :)