QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#217713 | #5024. 【模板】双端队列 | chenxinyang2006 | 0 | 130ms | 4260kb | C++14 | 1.6kb | 2023-10-17 11:01:33 | 2023-10-17 11:01:33 |
Judging History
answer
#include <bits/stdc++.h>
#define rep(i,j,k) for(int i=(j);i<=(k);i++)
#define per(i,j,k) for(int i=(j);i>=(k);i--)
#define uint unsigned int
#define ll long long
#define ull unsigned long long
#define db double
#define ldb long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mkp make_pair
#define eb emplace_back
#define SZ(S) (int)S.size()
//#define mod 998244353
//#define mod 1000000007
#define inf 0x3f3f3f3f
#define linf 0x3f3f3f3f3f3f3f3f
using namespace std;
template <class T>
void chkmax(T &x,T y){
if(x < y) x = y;
}
template <class T>
void chkmin(T &x,T y){
if(x > y) x = y;
}
inline int popcnt(int x){
return __builtin_popcount(x);
}
inline int ctz(int x){
return __builtin_ctz(x);
}
/*ll power(ll p,int k = mod - 2){
ll ans = 1;
while(k){
if(k % 2 == 1) ans = ans * p % mod;
p = p * p % mod;
k /= 2;
}
return ans;
}*/
int T,n;
int a[50005],b[50005];
void solve(){
scanf("%d",&n);
int sum = 0;
rep(i,1,n){
scanf("%d",&a[i]);
sum ^= a[i];
}
if(!sum){
printf("Draw\n");
return;
}
int p = __lg(sum);
rep(i,1,n) b[i] = (a[i] >> p) & 1;
if(n % 2 == 1){
rep(i,1,n){
if(!b[i]){
printf("First\n");
return;
}
}
printf("Second\n");
return;
}
int c0 = 0,c1 = 1;
rep(i,1,n){
if(!b[i]) c0++;
else c1++;
}
if((!b[1] || !b[n]) && c0 == 1){
printf("First\n");
return;
}
if((b[1] || b[n]) && c1 == 1){
printf("First\n");
return;
}
printf("Second\n");
}
int main(){
scanf("%d",&T);
while(T--) solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3764kb
input:
40 15 1042186166 1065050038 1052442342 117744385 1044381358 996146407 947617159 1031691934 27328777 130294601 1065311743 1065082111 12845136 941620871 1042177446 15 1068465534 15766217 69219008 95461385 1048542590 1051709438 1048575351 1072652151 978275647 1044381687 999247358 1062194999 1054829887 ...
output:
First First First First First First First Draw Draw Draw Draw First First First First First First Draw First First First Draw First Draw Draw First First First Draw First First First First First First First First First First Draw
result:
wrong answer 1st words differ - expected: 'Second', found: 'First'
Subtask #2:
score: 0
Wrong Answer
Test #2:
score: 0
Wrong Answer
time: 3ms
memory: 3840kb
input:
40 987 1073733087 9437225 570431533 1031755263 1031755251 579873284 571521061 536872960 546353705 43000364 535780827 1065313790 536834043 41953824 503270871 1040175099 8426021 537960961 1054732 545292837 34648585 34603052 546314244 537965060 9439748 41953292 43037189 9447949 536864767 1073698294 503...
output:
First First First First First First First First First First Draw First First First First First First First Draw Draw Draw Draw First First First First First First First First Draw First First First First Draw First First First First
result:
wrong answer 1st words differ - expected: 'Second', found: 'First'
Subtask #3:
score: 0
Wrong Answer
Test #4:
score: 0
Wrong Answer
time: 126ms
memory: 4216kb
input:
40 49999 30704571 23631198 10459697 452884 909025 3745220 5633170 29257098 24428644 21991837 21100897 21249665 18667093 13809790 21220831 32750672 29531337 31709216 17139349 4444339 787544 14509794 3855820 201034 13281440 26541636 31476242 10318360 20485824 26793325 8264891 22349828 20554718 7556006...
output:
First Second First First Second First First Second First First First Second Second Second First First First First Second Second First First First First Second Second First Second First Second Second Second Second First Second First Second Second Second Second
result:
wrong answer 1st words differ - expected: 'Second', found: 'First'
Subtask #4:
score: 0
Wrong Answer
Test #6:
score: 0
Wrong Answer
time: 130ms
memory: 4260kb
input:
40 49035 1073176430 531291499 1005508607 675350672 368768 867368831 139504132 1321089 134482448 464248170 1068169195 68946580 469491567 738764816 742459920 535197167 531887598 672172545 609558673 608209040 335282031 532674543 72878741 610117777 138447508 398155759 71608464 672172165 402325355 609845...
output:
First First First First First First Draw First First Draw First First First First First First First First First Draw First First Draw First First First First First First First First Draw First First First First First First First First
result:
wrong answer 2nd words differ - expected: 'Second', found: 'First'