QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#190105 | #4797. Xormites | _set_ | WA | 0ms | 3636kb | C++20 | 2.1kb | 2023-09-28 11:35:05 | 2023-09-28 11:35:05 |
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();
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3636kb
input:
3 2 3 3 2 3 5 3 4 4 4
output:
Draw Alice Bob
result:
wrong answer 2nd lines differ - expected: 'First', found: 'Alice'