QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#656849 | #9481. Min Nim | ucup-team896# | WA | 0ms | 3668kb | C++14 | 589b | 2024-10-19 13:47:00 | 2024-10-19 13:47:00 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int mod=998244353;
int T,n,p[200010],ans=1,ok;
bool solve(int l,int r){
if((r-l+1)&1)return 1;
int u=l;
while(u<r&&p[u+1]==p[l])
u++;
if((u-l+1)%2==1){
return (p[l]-p[l-1])&1;
}else if(u==r){
return 0;
}else{
return solve(u+1,r)^((p[l]-p[l-1]+1)%2);
}
}
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
cin>>T;
while(T--){
cin>>n;
ok=0;
for(int i=1;i<=n;i++)
cin>>p[i];
sort(p+1,p+n+1);
if(solve(1,n)){
cout<<"First\n";
}else{
cout<<"Second\n";
}
}
return 0;
}
详细
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3668kb
input:
2 3 3 1 4 8 3 1 4 1 5 9 2 6
output:
First First
result:
wrong answer 2nd words differ - expected: 'Second', found: 'First'