QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#656800 | #9481. Min Nim | ucup-team896# | WA | 8ms | 4068kb | C++14 | 548b | 2024-10-19 13:43:08 | 2024-10-19 13:43:08 |
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==r){
return 0;
}else{
return solve(u+1,r)^((p[l]-p[l-1]+1)%2)^((u-l+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;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3692kb
input:
2 3 3 1 4 8 3 1 4 1 5 9 2 6
output:
First Second
result:
ok 2 tokens
Test #2:
score: 0
Accepted
time: 7ms
memory: 4036kb
input:
1 100000 825605713 825605713 825605713 825605713 825605713 825605713 825605713 825605713 825605713 825605713 825605713 825605713 825605713 825605713 825605713 825605713 825605713 825605713 825605713 825605713 825605713 825605713 825605713 825605713 825605713 825605713 825605713 825605713 825605713 8...
output:
Second
result:
ok "Second"
Test #3:
score: 0
Accepted
time: 3ms
memory: 4068kb
input:
1 99999 80011714 80011714 80011714 80011714 80011714 80011714 80011714 80011714 80011714 80011714 80011714 80011714 80011714 80011714 80011714 80011714 80011714 80011714 80011714 80011714 80011714 80011714 80011714 80011714 80011714 80011714 80011714 80011714 80011714 80011714 80011714 80011714 8001...
output:
First
result:
ok "First"
Test #4:
score: 0
Accepted
time: 8ms
memory: 3944kb
input:
1 78425 68217 42000 55359 54442 49297 40030 519 53351 51488 77091 60533 19838 56156 25791 74518 20632 19144 65724 72247 50453 36895 63836 10801 66715 40374 44054 3217 33986 8221 8788 13517 70202 73285 10081 70046 28329 5125 12397 35407 40647 58512 18791 65149 10893 20811 65951 42479 72915 4876 74362...
output:
First
result:
ok "First"
Test #5:
score: -100
Wrong Answer
time: 7ms
memory: 3944kb
input:
1 69098 27088 61575 24263 46325 34362 14135 54594 9913 68664 52710 63218 53742 24588 40288 28273 48305 11086 17622 67877 36595 15036 10490 56916 51589 47589 24068 25642 32137 51847 31661 22753 11345 62378 46432 8939 29319 63388 5644 1824 26407 15890 42482 31743 24179 35707 39181 1080 44846 65762 128...
output:
Second
result:
wrong answer 1st words differ - expected: 'First', found: 'Second'