The title probably said that there are n rows, 20 squares per line, there are some pieces, two people take turns to do this: Select a line to move a piece to the right of the first empty grid. Unable to carry out the loss of the person. Ask if you can win the tempo.
This game is obviously a combination of game, the initiator alternately, each decision is limited, there are victory conditions. Then the SG theorem was made. The set record set is actually t ....
#include <cstdio> #include <iostream> #include <set> using namespace std; #define L (i) i<<1 #define R (i) i<<1|1 #define INF 0x3f3f3f3f #define PI ACOs ( -1.0) #define EPS 1e-9 #define M
AXN 2000010 #define MOD 1000000007 int n,m;
int SG[MAXN];
int main () {int t;
Sg[0] = 0;
SG[1] = 0;
for (int x = 2; <= (1<<20); x + +) {int h[25] = {0};
int pre =-1;
for (int i = 0; I <=; i++) {if (x& (1<<i)) {if (pre = =-1)
Continue
else {int k = x-(1<<i) + (1<<PRE);
H[SG[K]] = 1;
}} else pre = i;
} int res = 0;
while (H[res]) res++;
SG[X] = res;
} scanf ("%d", &t);
while (t--) {scanf ("%d", &n);
int ans = 0; FoR (int i = 0; i < n; i++) {scanf ("%d", &m);
int k = 0;
for (int j = 0; J < m; J + +) {int x;
scanf ("%d", &x);
K + = (1<< (20-x));
} ans ^= sg[k]; } printf ("%s\n", ans==0?)
NO ":" Yes ");
} return 0; }