NK05MNIM - Bốc sỏi
Tác giả: skyvn97
Ngôn ngữ: C++
#include<cstdio>
#define REP(i,n) for (int i=0,_n=(n);i<_n;i=i+1)
int nextInt(void) {
int x;
scanf("%d",&x);
return (x);
}
int main(void) {
REP(romeo,nextInt()) {
int res=0;
int maxVal=0;
REP(juliet,nextInt()) {
int t=nextInt();
res^=t;
if (maxVal<t) maxVal=t;
}
res^=maxVal==1;
printf("%d\n",res>0?1:-1);
}
return 0;
}