QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#692829 | #835. Easy Win | sdyzpf | WA | 2ms | 12024kb | C++20 | 700b | 2024-10-31 15:06:25 | 2024-10-31 15:06:25 |
Judging History
answer
# include <bits/stdc++.h>
using namespace std;
int a[500010],sum[500010],f[20][500010],ans[500010];
int main()
{
int n,x;
cin>>n;
for(int i=0;i<n;i++) scanf("%d",&x),a[x]^=1;
for(int i=1;i<=n;i++) sum[i]=sum[i-1]^a[i];
for(int i=0;i<=18;i++)
for(int j=n-(1<<i);j>=0;j--)
f[i][j]=sum[j+(1<<i)-1]^sum[min(j+(1<<i+1)-1,n)]^(j+(1<<i+1)<=n?f[i][j+(1<<i+1)]:0);
for(int j=0;j<=18;j++)
for(int i=2;i<=n+1;i++)
{
for(int l=0;l<=n;l+=i)
{
int r=min(l+i-1,n),s=f[j][l]^f[j][l+((r-l>>j+1)<<j+1)];
if((r-l>>j)&1) s^=sum[r]^sum[l+((r-l>>j)<<j)-1];
ans[i]^=s<<j;
}
}
for(int i=1;i<=n;i++) printf("%s%c",ans[i]?"Alice":"Bob"," \n"[i==n+1]);
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 2ms
memory: 12024kb
input:
6 6 6 6 6 6 6
output:
Bob Bob Bob Bob Bob Bob
result:
ok 6 tokens
Test #2:
score: -100
Wrong Answer
time: 2ms
memory: 12012kb
input:
4 1 2 3 4
output:
Bob Bob Alice Bob
result:
wrong answer 2nd words differ - expected: 'Alice', found: 'Bob'