QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#611030#7686. The Phantom MenaceANIG#WA 5ms15928kbC++14963b2024-10-04 18:55:442024-10-04 18:55:45

Judging History

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

  • [2024-10-08 14:11:03]
  • hack成功,自动添加数据
  • (/hack/941)
  • [2024-10-08 10:05:28]
  • hack成功,自动添加数据
  • (/hack/940)
  • [2024-10-07 19:51:15]
  • hack成功,自动添加数据
  • (/hack/938)
  • [2024-10-07 19:28:01]
  • hack成功,自动添加数据
  • (/hack/937)
  • [2024-10-07 17:16:32]
  • hack成功,自动添加数据
  • (/hack/936)
  • [2024-10-07 16:53:09]
  • hack成功,自动添加数据
  • (/hack/935)
  • [2024-10-07 16:22:17]
  • hack成功,自动添加数据
  • (/hack/934)
  • [2024-10-04 18:55:45]
  • 评测
  • 测评结果:WA
  • 用时:5ms
  • 内存:15928kb
  • [2024-10-04 18:55:44]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define int long long
const int mods=998244353,N=5e5+5;
struct xxj{
	int w[25];
	void add(int x){
		for(int i=20;i>=0;i--){
			if(x>>i&1){
				if(w[i])x^=w[i];
				else{
					w[i]=x;
					return;
				}
			}
		}
	}
	int siz(){
		int res=0;
		for(int i=0;i<=20;i++)res+=w[i]!=0;
		return res;
	}
}emp,q[N];
int t,n,p[N],sm[N],f[N],pw[N],dd[N];
signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	pw[0]=1;
	for(int i=1;i<N;i++)pw[i]=pw[i-1]*2%mods;
	cin>>t;
	while(t--){
		xxj qq=emp;
		for(int i=0;i<=n;i++)dd[i]=sm[i]=0;
		int res=0;
		cin>>n;
		for(int i=1;i<=n;i++)cin>>p[i],sm[p[i]]++,qq.add(p[i]);
		res=pw[n-qq.siz()];
		for(int i=1;i<=n;i++)q[i]=emp;
		for(int i=1;i<=n;i++){
			if(sm[i])for(int j=i+i;j<=n;j+=i)dd[j]+=sm[i],q[j].add(i);
		}
		for(int i=1;i<=n;i++)if(sm[i])res+=pw[dd[i]+sm[i]-1-q[i].siz()];
		cout<<(res%mods-1+mods)%mods<<"\n";
	}
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 5ms
memory: 15928kb

input:

2
3 3
abc
ghi
def
bcd
efg
hia
1 3
abc
def

output:

4
4

result:

wrong output format Unexpected end of file - int32 expected (test case 1)