take n % 3
, if 0 then A loses
A always wins
If only 2 piles are left, and both != 1, then A loses.
Then the case left is that there are multiple piles with only 1 left,
- if the number of 1-piles % 3 == 0, A loses
- else, if there exists a pile of 2, A wins
All other cases results in A losing
#pragma comment(linker, "/STACK:1024000000,1024000000")
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <iostream>
using namespace std;
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3f
#define ll long long
#define N 100100
int n;
int ONE, TWO;
inline bool work()
{
if (ONE == n - 1) return true;
else if (ONE == n)
return n % 3;
if (ONE == n - 2)
{
if (n % 3 == 2) return false;
if (TWO) return true;
return false;
}
return false;
}
inline void Run()
{
while (scanf("%d", &n) != EOF)
{
ONE = 0, TWO = 0;
for (int i = 1, num; i <= n; ++i)
{
scanf("%d", &num);
if (num == 1) ++ONE;
if (num == 2) ++TWO;
}
puts(work() ? "Win" : "Lose");
}
}
int main()
{
#ifdef LOCAL
freopen("Test.in", "r", stdin);
#endif
Run();
return 0;
}