Skip to content
We areTOP 1%

Lieges of Legendre

HardRating 2200CodeforcesGame Theory
Solve on Codeforces(opens in a new tab)
Track your progress
First attempt
Re-solve after a few days
Final pass before interviews
Approach hintTry it first, then reveal

Compute Grundy values of small piles by hand, separately for even and odd k. Even k gives a short fixed pattern; odd k settles into a pattern where even sizes recurse on half the size. XOR the values of all piles.

More in Game Theory

Game Theory questions
#ProblemPlatformDifficultyOpen1st1st Visit2nd2nd VisitRevRevise
1Stone Game IIILeetCodeHard Solve Stone Game III on LeetCode (opens in a new tab)
21-2-K GameCodeforcesMedium 1700Solve 1-2-K Game on Codeforces (opens in a new tab)
3Stoned GameCodeforcesHard 1800Solve Stoned Game on Codeforces (opens in a new tab)
4A Lot of GamesCodeforcesHard 1900Solve A Lot of Games on Codeforces (opens in a new tab)
5GameGameCodeforcesHard 1900Solve GameGame on Codeforces (opens in a new tab)
6Tree TagCodeforcesHard 1900Solve Tree Tag on Codeforces (opens in a new tab)
7Cat and MouseLeetCodeHard Solve Cat and Mouse on LeetCode (opens in a new tab)
8Not a Nim ProblemCodeforcesHard 2100Solve Not a Nim Problem on Codeforces (opens in a new tab)
9Lieges of LegendreCodeforcesHard 2200Solve Lieges of Legendre on Codeforces (opens in a new tab)

Sign in to track your progress

Your checkboxes, streak and activity heatmap are saved to your account and sync across devices. It is free.
Sign in with email

New here? Create an account