UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#197149#2444. 自同构wosile10021ms4828kbC++11917b2023-11-07 11:40:102023-11-07 12:11:09

answer

#include<bits/stdc++.h>
using namespace std;
int n;
int vis[10000005];
bitset<5005>b[505],c[5005];
int a[505];
int tot=0;
void prew(int id,int x){
	for(int i=2;i*i<=x;i++){
		if(x%i==0){
			int f=0;
			while(x%i==0){
				f^=1;
				x/=i;
			}
			if(f){
				if(!vis[i])vis[i]=++tot;
				b[id][vis[i]]=1;
			}
		}
	}
	if(x>1){
		if(!vis[x])vis[x]=++tot;
		b[id][vis[x]]=1;
	}
}
bool check(bitset<5005>tmp){
	for(int i=1;i<=tot;i++)if(tmp[i]==1){
		if(c[i][i]==0)return false;
		tmp^=c[i];
	}
	return true;
}
void ins(bitset<5005>tmp){
	for(int i=1;i<=tot;i++)if(tmp[i]==1){
		if(c[i][i]==0){
			c[i]=tmp;
			return;
		}
		tmp^=c[i];
	}
}
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++)scanf("%d",&a[i]);
	for(int i=1;i<=n;i++)prew(i,a[i]);
	int ans=1;
	for(int i=1;i<=n;i++)if(!check(b[i])){
		ins(b[i]);
		ans=ans*2%1000000007;
	}
	printf("%d",ans);
	return 0;
}

详细

小提示:点击横条可展开更详细的信息

Test #1:

score: 10
Accepted
time: 0ms
memory: 4588kb

input:

5
34 57 57 39 19

output:

16

result:

ok 1 number(s): "16"

Test #2:

score: 10
Accepted
time: 0ms
memory: 4588kb

input:

5
53 89 85 1 73

output:

16

result:

ok 1 number(s): "16"

Test #3:

score: 10
Accepted
time: 2ms
memory: 4600kb

input:

19
9802059 6825390 5046093 8035993 5292482 5123360 7038798 7883070 1544818 6882527 9529015 2979795 3...

output:

524288

result:

ok 1 number(s): "524288"

Test #4:

score: 10
Accepted
time: 0ms
memory: 4604kb

input:

20
6830902 5702906 7016405 1340963 6768895 3445954 7139965 3776003 9152545 2801120 3893910 3922081 2...

output:

1048576

result:

ok 1 number(s): "1048576"

Test #5:

score: 10
Accepted
time: 2ms
memory: 4600kb

input:

400
1918 1228 311 1974 1634 2088 1123 2158 1053 2200 1123 2273 2419 1169 933 1523 2047 2743 1507 151...

output:

248320570

result:

ok 1 number(s): "248320570"

Test #6:

score: 10
Accepted
time: 0ms
memory: 4604kb

input:

500
1753 2095 1847 2768 2753 2362 1157 1777 1597 2957 1243 641 2203 1478 2467 2471 2699 337 2066 165...

output:

993526229

result:

ok 1 number(s): "993526229"

Test #7:

score: 10
Accepted
time: 0ms
memory: 4684kb

input:

480
4028334 9221377 5322197 8722753 9203050 3960133 7962231 7368927 6219749 6764483 9082247 5322197 ...

output:

779974913

result:

ok 1 number(s): "779974913"

Test #8:

score: 10
Accepted
time: 6ms
memory: 4704kb

input:

490
9396439 7799406 4747098 3203269 8076610 8512674 5182167 4581241 7740133 4998046 9191494 5049813 ...

output:

199161894

result:

ok 1 number(s): "199161894"

Test #9:

score: 10
Accepted
time: 6ms
memory: 4828kb

input:

500
3557578 3158603 7940111 962809 7537625 5322103 7216021 4925147 9988786 6237100 2313921 9834442 1...

output:

136896910

result:

ok 1 number(s): "136896910"

Test #10:

score: 10
Accepted
time: 5ms
memory: 4744kb

input:

500
9366729 5436407 3648433 7858699 9921238 9606703 9634282 6249377 2924693 7757039 9225887 7797863 ...

output:

730952599

result:

ok 1 number(s): "730952599"