QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#656670#9481. Min Nimucup-team896#WA 7ms4064kbC++14553b2024-10-19 13:31:212024-10-19 13:31:22

Judging History

This is the latest submission verdict.

  • [2024-10-19 13:31:22]
  • Judged
  • Verdict: WA
  • Time: 7ms
  • Memory: 4064kb
  • [2024-10-19 13:31:21]
  • Submitted

answer

#include<bits/stdc++.h>
using namespace std;
const int mod=998244353;
int T,n,p[200010],ans=1;
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]&1;
	}else if(u==r){
		return p[l]&1;
	}else{
		return solve(u+1,r);
	}
}
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin>>T;
	while(T--){
		cin>>n;
		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: 3720kb

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: -100
Wrong Answer
time: 7ms
memory: 4064kb

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:

First

result:

wrong answer 1st words differ - expected: 'Second', found: 'First'