QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#692829#835. Easy WinsdyzpfWA 2ms12024kbC++20700b2024-10-31 15:06:252024-10-31 15:06:25

Judging History

你现在查看的是最新测评结果

  • [2024-10-31 15:06:25]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:12024kb
  • [2024-10-31 15:06:25]
  • 提交

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'