QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#68485#4797. XormitesA_zjzjWA 2ms3660kbC++14625b2022-12-16 20:23:262022-12-16 20:23:27

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-12-16 20:23:27]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3660kb
  • [2022-12-16 20:23:26]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;using ll=long long;const int N=5e4+10;
int T,n,s,a[N];char buf[3][10]={"Draw","First","Second"};
int get(){
	s=0;scanf("%d",&n);for(int i=1;i<=n;i++)scanf("%d",&a[i]),s^=a[i];
	if(!s)return 0;if(!(n&1))return 1;for(int i=__lg(s);~i;i--)if(s>>i&1){
		for(int j=1;j<=n;j++)a[j]=a[j]>>i&1;
		int l=1,r=n,now=0;
		for(;l<=r&&a[l]==a[r];l++,r--)now^=a[l];
		if(l>r)return now&1?1:2;
		int cnt=0;
		for(int j=l;j<r;j++)cnt+=a[j]^a[j+1],now^=a[j];
		if(cnt>1)return 1;
		return now&1?1:2;
	}return 0;
}
int main(){
	for(scanf("%d",&T);T--;)puts(buf[get()]);return 0;
}

详细

Test #1:

score: 100
Accepted
time: 2ms
memory: 3660kb

input:

3
2
3 3
2
3 5
3
4 4 4

output:

Draw
First
Second

result:

ok 3 lines

Test #2:

score: -100
Wrong Answer
time: 2ms
memory: 3528kb

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
First
First
First
First
Draw
First
First
Draw
Draw
Draw

result:

wrong answer 3rd lines differ - expected: 'Second', found: 'First'