#include #include #include #include #include #include #include #include #include #include using namespace std; int grundy(vector &memo, vector &p, int N){ if(memo[N] >= 0) return memo[N]; set s; for(int i=0; i> N; vector is_P(N+1, true); is_P[0] = is_P[1] = false; vector prime; for(int i=2; i<=N; i++){ if(is_P[i] == false) continue; prime.push_back(i); for(int j=i+i; j<=N; j+=i){ is_P[j] = false; } } vector memo(N+1, -1); memo[0] = memo[1] = 0; cout << (grundy(memo, prime, N) == 0 ? "Lose":"Win") << endl; return 0; }