Skip to main content

Practice · 6 of 8

The Stone Game

CHALLENGE
Difficulty: advanced+25 XP

**Tình huống.** n ≤ 100000 piles of stones; two players alternate removing any positive number of stones from one pile; the player taking the last stone wins. Both play optimally. Who wins? **Thuật toán nào phù hợp nhất? Chương trình chỉ cần in ra chữ cái.** **A)** Simulate the game with BFS over pile states **B)** XOR of all pile sizes: first player wins iff nonzero **C)** Sort piles and greedy the largest **D)** Dijkstra on the state graph

Back to lesson: Practice: Recognition Drill Set 1