QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#190085 | #5024. 【模板】双端队列 | _set_ | 0 | 55ms | 3712kb | C++20 | 2.1kb | 2023-09-28 10:49:22 | 2023-09-28 10:49:22 |
Judging History
answer
// 作者: caigou
// 日期: 2022-02-26 09:11
#include<bits/stdc++.h>
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define pc putchar
#define chkmx(a,b) (a)=max((a),(b))
#define chkmn(a,b) (a)=min((a),(b))
#define fi first
#define se second
using namespace std;
template<class T>
void read(T&x){x=0;char c=getchar();bool f=0;for(;!isdigit(c);c=getchar())f^=c=='-';for(;isdigit(c);c=getchar())x=x*10+c-'0';if(f)x=-x;}
template<class T,class ...ARK>void read(T&x,ARK&...ark){read(x);read(ark...);}
template<class T>void write(T x){if(x<0)pc('-'),x=-x;if(x>=10)write(x/10);pc(x%10+'0');}
template<class T,class ...ARK>void write(T x,ARK...ark){write(x);pc(' ');write(ark...);}
template<class ...ARK>void writeln(ARK...ark){write(ark...);pc('\n');}
typedef long long ll;
const int mod=998244353;
struct mint{
int x;mint(int o=0){x=o;}mint&operator+=(mint a){return(x+=a.x)%=mod,*this;}mint&operator-=(mint a){return(x+=mod-a.x)%=mod,*this;}
mint&operator*=(mint a){return(x=1ll*x*a.x%mod),*this;}mint&operator^=( int b){mint a=*this;x=1;while(b)(b&1)&&(*this*=a,1),a*=a,b>>=1;return*this;}
mint&operator/=(mint a){return*this*=(a^=mod-2);}friend mint operator+(mint a,mint b){return a+=b;}friend mint operator-(mint a,mint b){return a-=b;}
friend mint operator*(mint a,mint b){return a*=b;}friend mint operator/(mint a,mint b){return a/=b;}friend mint operator^(mint a, int b){return a^=b;}
};
#define lowbit(x) ((x)&-(x))
#define mid ((l+r)>>1)
#define lc (x<<1)
#define rc (x<<1|1)
const int N=1e5+10;
int T,n,a[N];
bool chk(int l,int r){
while(l<r&&a[l]==a[r])l++,r--;
for(int i=l;i<=r;i+=2)
if(a[i]!=a[i+1])return 0;
return 1;
}
void work(){
read(n);int sum=0,tot=0,pos=-1;
for(int i=1;i<=n;i++)read(a[i]),sum^=a[i];
if(!sum)return puts("Draw"),void();
while(sum)pos++,sum>>=1;
for(int i=1;i<=n;i++)a[i]=(a[i]>>pos&1),tot+=a[i];
if(n%2==0)puts("Alice");
else{
if((tot-1)%4)puts("Bob");
else{
if((a[1]&&chk(2,n))||(a[n]&&chk(1,n-1)))
puts("Alice");
else puts("Bob");
}
}
}
signed main(){
read(T);
while(T--)work();
}
詳細信息
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3432kb
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:
Bob Bob Bob Alice Alice Bob Bob Draw Draw Draw Draw Bob Bob Bob Bob Alice Alice Draw Bob Bob Bob Draw Bob Draw Draw Alice Bob Bob Draw Bob Alice Alice Bob Bob Alice Alice Bob Alice Alice Draw
result:
wrong answer 1st words differ - expected: 'Second', found: 'Bob'
Subtask #2:
score: 0
Wrong Answer
Test #2:
score: 0
Wrong Answer
time: 2ms
memory: 3556kb
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:
Bob Bob Alice Bob Alice Bob Bob Alice Bob Alice Draw Alice Bob Alice Alice Bob Bob Bob Draw Draw Draw Draw Alice Bob Bob Bob Bob Alice Bob Bob Draw Bob Alice Bob Alice Draw Bob Alice Alice Alice
result:
wrong answer 1st words differ - expected: 'Second', found: 'Bob'
Subtask #3:
score: 0
Wrong Answer
Test #4:
score: 0
Wrong Answer
time: 55ms
memory: 3616kb
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:
Bob Alice Bob Bob Alice Bob Bob Alice Bob Bob Bob Alice Alice Alice Bob Bob Bob Bob Alice Alice Bob Bob Bob Bob Alice Alice Bob Alice Bob Alice Alice Alice Alice Bob Alice Bob Alice Alice Alice Alice
result:
wrong answer 1st words differ - expected: 'Second', found: 'Bob'
Subtask #4:
score: 0
Wrong Answer
Test #6:
score: 0
Wrong Answer
time: 52ms
memory: 3712kb
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:
Alice Bob Alice Alice Bob Bob Draw Alice Bob Draw Alice Alice Alice Bob Alice Alice Alice Bob Alice Draw Alice Alice Draw Bob Alice Bob Bob Bob Bob Bob Alice Draw Alice Alice Bob Alice Alice Alice Alice Alice
result:
wrong answer 1st words differ - expected: 'First', found: 'Alice'