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

Автор vivek., история, 23 месяца назад, По-английски

Hello, In the Problem 1695B ( https://codeforces.com/contest/1695/problem/B ), when no. of piles is odd i.e. n is odd, the solution (tutorial) states the following statement: "If n is odd, Mike can remove all of the stones from the first pile. Then, on the n+1th turn (the first turn where the game can end), Joe will be forced to remove from the first pile, which is empty. So Mike can always win if n is odd."

But when observed for below example , n=5 entries=9 1 8 10 11 after first iteration the entries will be: 8 0 7 9 10 , and the turn will be of Mike at zero and thus Joe will win. This contradicts the tutorial solution.

If the tutorial solution is correct, please explain the logic for the same.

Thank you

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

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

The players are allowed to remove as many stones as they like. Mike can remove all 9 stones from the first pile in his first turn.

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

    yes but it isnt always the case

    • »
      »
      »
      23 месяца назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

      Yes of course Mike could always remove all the stones from the first pile. But if n is even that means that after one iteration around the circle it will be Mike's turn again to remove stones from the first pile. And if there are no stones left he will lose. So that would be a bad strategy.