QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#344954 | #4797. Xormites | Kevin5307 | WA | 1ms | 3732kb | C++20 | 1.2kb | 2024-03-05 20:07:32 | 2024-03-05 20:07:33 |
Judging History
answer
//Author: Kevin
#include<bits/stdc++.h>
//#pragma GCC optimize("O2")
using namespace std;
#define pb emplace_back
#define mp make_pair
#define ALL(x) (x).begin(),(x).end()
#define rALL(x) (x).rbegin(),(x).rend()
#define srt(x) sort(ALL(x))
#define rev(x) reverse(ALL(x))
#define rsrt(x) sort(rALL(x))
#define sz(x) (int)(x.size())
#define inf 0x3f3f3f3f
#define lb(v,x) (int)(lower_bound(ALL(v),x)-v.begin())
#define ub(v,x) (int)(upper_bound(ALL(v),x)-v.begin())
#define uni(v) v.resize(unique(ALL(v))-v.begin())
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;
using i128=__int128;
void die(string S){puts(S.c_str());exit(0);}
int A[50005];
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int t;
cin>>t;
while(t--)
{
int n;
cin>>n;
for(int i=1;i<=n;i++)
cin>>A[i];
int xo=0;
for(int i=1;i<=n;i++)
xo^=A[i];
if(!xo)
puts("Draw");
else if(n%2==0)
puts("First");
else
{
int x=__lg(xo);
for(int i=1;i<=n;i++)
A[i]=A[i]>>x&1;
int val=0;
for(int i=1;i<=n;i+=2)
val^=A[i];
if(val&&(A[1]||A[n]))
puts("First");
else
puts("Second");
}
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3656kb
input:
3 2 3 3 2 3 5 3 4 4 4
output:
Draw First Second
result:
ok 3 lines
Test #2:
score: 0
Accepted
time: 1ms
memory: 3732kb
input:
12 10 1 3 1 3 3 3 2 1 3 3 10 1 3 3 3 1 3 2 1 1 3 9 1 2 3 3 3 1 2 2 3 9 1 3 2 1 3 3 2 2 2 10 3 2 2 2 3 3 1 2 1 2 10 2 1 2 3 3 3 3 2 3 2 10 2 1 1 3 3 1 1 1 2 1 10 2 1 1 1 1 1 1 2 2 3 10 2 1 2 1 1 2 2 3 3 3 9 2 2 1 1 3 3 1 2 3 9 1 3 3 2 2 2 2 3 2 10 1 1 1 1 1 2 2 2 1 2
output:
First First Second Second First First Draw First First Draw Draw Draw
result:
ok 12 lines
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 3668kb
input:
12 9 3 4 1 5 2 1 5 3 1 10 6 2 4 5 4 2 5 7 5 6 9 5 3 2 1 2 4 4 1 4 9 5 7 6 2 7 2 5 7 4 10 7 5 1 6 7 1 5 1 4 5 10 4 2 6 2 7 2 2 2 3 5 10 7 3 4 7 4 4 2 3 7 5 9 3 3 7 1 6 3 7 2 3 10 5 3 7 7 2 6 4 7 3 1 10 1 7 4 2 4 2 6 6 4 4 10 4 1 3 4 4 4 5 4 1 7 9 4 3 4 7 1 6 2 2 5
output:
Second First Second First First First First Second First First First First
result:
wrong answer 4th lines differ - expected: 'Second', found: 'First'