E.是是非非
链接:https://www.nowcoder.com/acm/contest/86/E
这个题就是尼姆博奕(我的队友小可爱很擅长这个)
代码:
1 //E
2 #include<iostream>
3 #include<cstdio>
4 #include<cstring>
5 #include<cmath>
6 #include<cstdlib>
7 #include<algorithm>
8 #include<queue>
9 #include<vector>
10 #include<stack>
11 using namespace std;
12 typedef long long ll;
13 const int maxn=1e5+10;
14 const double eps=1e-7;
15 int a[maxn];
16 int main(){
17 int n,q;
18 cin>>n>>q;
19 int ans=0;
20 for(int i=1;i<=n;i++){
21 cin>>a[i];
22 ans^=a[i];
23 }
24 while(q--){
25 int x,y;
26 cin>>x>>y;
27 ans^=a[x];
28 a[x]=y;
29 ans^=y;
30 if(ans)
31 cout<<"Kan"<<endl;
32 else
33 cout<<"Li"<<endl;
34 }
35 }