空格数变吗?不变呀
阶梯博弈阶梯数变吗?不变呀
那这不就阶梯博弈,每行一栋楼,爬完\(mex\)就可以了吗?
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#define R(a,b,c) for(register int a = (b); a <= (c); ++a)
#define nR(a,b,c) for(register int a = (b); a >= (c); --a)
#define Fill(a,b) memset(a, b, sizeof(a))
#define Swap(a,b) ((a) ^= (b) ^= (a) ^= (b))
#define ON_DEBUGG
#ifdef ON_DEBUGG
#define D_e_Line printf("-----------\n")
#define D_e(x) std::cout << (#x) << " : " <<x << "\n"
#define FileOpen() freopen("in.txt", "r", stdin)
#define FileSave() freopen("out.txt", "w", stdout)
#define Pause() system("pause")
#include <ctime>
#define TIME() fprintf(stderr, "\nTIME : %.3lfms\n", clock() * 1000.0 / CLOCKS_PER_SEC)
#else
#define D_e_Line ;
#define D_e(x) ;
#define FileOpen() ;
#define FilSave ;
#define Pause() ;
#define TIME() ;
#endif
struct ios {
template<typename ATP> ios& operator >> (ATP &x) {
x = 0; int f = 1; char c;
for(c = getchar(); c < '0' || c > '9'; c = getchar()) if(c == '-') f = -1;
while(c >= '0' && c <= '9') x = x * 10 + (c ^ '0'), c = getchar();
x *= f;
return *this;
}
}io;
using namespace std;
template<typename ATP> inline ATP Min(ATP a, ATP b) {
return a < b ? a : b;
}
template<typename ATP> inline ATP Max(ATP a, ATP b) {
return a > b ? a : b;
}
template<typename ATP> inline ATP Abs(ATP a) {
return a < 0 ? -a : a;
}
const int N = 100007;
bool mex[N];
int main() {
int Tasks;
io >> Tasks;
while(Tasks--){
int n;
io >> n;
long long ans2 = 0;
while(n--){
int K;
io >> K;
Fill(mex, 0);
long long ans1 = 0;
int cnt = 20 - K + 1, tot = 0;
while(K--){
int x;
io >> x;
mex[x] = 1;
}
R(i,1,20){
if(!mex[i]){
if((--cnt) & 1) ans1 ^= tot;
tot = 0;
}
else
++tot;
}
ans2 ^= ans1;
}
if(ans2)
printf("YES\n");
else
printf("NO\n");
}
return 0;
}
原文地址:https://www.cnblogs.com/bingoyes/p/11710032.html
时间: 2024-10-09 11:53:21