5

[Help] Problem 1695B "circle game" logic when n is odd

 1 year ago
source link: http://codeforces.com/blog/entry/104871
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

[Help] Problem 1695B "circle game" logic when n is odd

By vivek., history, 2 hours ago,

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


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK