QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#527955#5062. SquareHadtstiWA 17ms5928kbC++14773b2024-08-23 00:16:572024-08-23 00:16:58

Judging History

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

  • [2024-08-23 00:16:58]
  • 评测
  • 测评结果:WA
  • 用时:17ms
  • 内存:5928kb
  • [2024-08-23 00:16:57]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int mod=1000000007;
int n,x,ans=1,sum[1000010];
int p[1010],cnt;
bitset<1010>S;
int power(int a,int b)
{
	int res=1;
	for(;b;b>>=1)
	{
		if(b&1)
			res=1ll*res*a%mod;
		a=1ll*a*a%mod;
	}
	return res;
}
int main()
{
	for(int i=2;i<=1000;i++)
		if(!S[i])
		{
			p[++cnt]=i;
			for(int j=i;j<=1000/i;j++)
				S[i*j]=1;
		}
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&x);
		for(int j=1;j<=cnt&&p[j]<=x/p[j];j++)
			if(x%p[j]==0)
			{
				int ct=0;
				while(x%p[j]==0)
				{
					ct++;
					x/=p[j];
				}
				sum[p[j]]+=(ct&1);
			}
		if(x>1)
			sum[x]++;
	}
	for(int i=2;i<=1000000;i++)
		ans=1ll*ans*power(i,min(sum[i],n-sum[i]));
	printf("%d",ans);
	return 0;
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3876kb

input:

3
2 3 6

output:

6

result:

ok 1 number(s): "6"

Test #2:

score: 0
Accepted
time: 1ms
memory: 3812kb

input:

1
1

output:

1

result:

ok 1 number(s): "1"

Test #3:

score: 0
Accepted
time: 5ms
memory: 3804kb

input:

100000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

1

result:

ok 1 number(s): "1"

Test #4:

score: 0
Accepted
time: 2ms
memory: 3732kb

input:

1000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

1

result:

ok 1 number(s): "1"

Test #5:

score: 0
Accepted
time: 2ms
memory: 3864kb

input:

1
130321

output:

1

result:

ok 1 number(s): "1"

Test #6:

score: 0
Accepted
time: 1ms
memory: 3948kb

input:

1
85849

output:

1

result:

ok 1 number(s): "1"

Test #7:

score: 0
Accepted
time: 2ms
memory: 3868kb

input:

10
1 37249 1 193 1 193 193 193 1 37249

output:

387487994

result:

ok 1 number(s): "387487994"

Test #8:

score: 0
Accepted
time: 1ms
memory: 3676kb

input:

10
130321 130321 6859 6859 6859 19 19 130321 361 6859

output:

130321

result:

ok 1 number(s): "130321"

Test #9:

score: 0
Accepted
time: 1ms
memory: 3888kb

input:

10
1 418609 1 418609 1 1 647 418609 1 1

output:

647

result:

ok 1 number(s): "647"

Test #10:

score: 0
Accepted
time: 0ms
memory: 3804kb

input:

10
85849 293 1 293 1 1 85849 293 293 293

output:

424869580

result:

ok 1 number(s): "424869580"

Test #11:

score: 0
Accepted
time: 0ms
memory: 3876kb

input:

10
16384 2048 8192 512 65536 524288 65536 4 2 262144

output:

32

result:

ok 1 number(s): "32"

Test #12:

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

input:

100000
1 197 1 38809 197 197 38809 1 197 197 1 38809 38809 1 1 1 1 38809 197 1 1 1 1 38809 197 197 1 38809 1 1 38809 38809 1 197 1 197 38809 38809 197 197 38809 1 38809 38809 197 38809 38809 197 197 1 38809 38809 38809 38809 38809 197 38809 38809 197 1 1 197 38809 38809 38809 197 1 1 1 197 197 197 1...

output:

810775411

result:

ok 1 number(s): "810775411"

Test #13:

score: 0
Accepted
time: 15ms
memory: 3884kb

input:

100000
1 1 597529 773 1 597529 1 773 1 597529 773 773 597529 773 597529 1 597529 773 773 1 1 597529 597529 773 773 597529 1 597529 1 1 773 773 1 597529 597529 597529 597529 597529 597529 773 597529 773 1 773 597529 773 1 1 773 773 773 597529 597529 1 1 773 773 773 773 597529 597529 597529 773 773 77...

output:

716188655

result:

ok 1 number(s): "716188655"

Test #14:

score: 0
Accepted
time: 16ms
memory: 5928kb

input:

100000
1 342337 1 342337 342337 342337 342337 1 342337 1 342337 1 342337 1 1 1 1 342337 1 1 1 342337 342337 1 1 342337 342337 1 1 342337 1 1 342337 342337 1 1 342337 342337 1 342337 342337 1 1 1 342337 1 1 1 1 342337 342337 342337 342337 1 342337 1 342337 1 1 1 342337 342337 1 1 1 342337 342337 1 34...

output:

158685643

result:

ok 1 number(s): "158685643"

Test #15:

score: 0
Accepted
time: 16ms
memory: 3948kb

input:

100000
877 1 1 877 877 877 1 769129 877 769129 769129 877 877 769129 877 769129 877 769129 877 1 769129 877 877 1 769129 877 769129 877 769129 1 769129 769129 877 877 769129 877 877 769129 877 877 1 877 769129 1 877 1 1 769129 769129 769129 1 1 877 769129 1 1 1 1 769129 877 877 769129 769129 877 1 1...

output:

208442677

result:

ok 1 number(s): "208442677"

Test #16:

score: 0
Accepted
time: 11ms
memory: 3820kb

input:

100000
347 1 120409 120409 120409 347 347 347 120409 1 347 1 1 347 120409 1 1 120409 1 347 1 1 1 347 120409 347 1 1 120409 120409 1 1 1 347 1 1 120409 120409 120409 347 120409 347 120409 347 347 347 1 347 1 1 1 347 347 1 120409 1 1 1 347 1 347 347 120409 120409 1 120409 120409 120409 347 1 120409 1 ...

output:

177423905

result:

ok 1 number(s): "177423905"

Test #17:

score: 0
Accepted
time: 6ms
memory: 3692kb

input:

100000
1 961 961 961 1 961 961 31 1 31 29791 31 1 31 29791 923521 1 31 961 29791 923521 961 1 923521 923521 923521 923521 923521 923521 923521 1 923521 1 29791 923521 29791 1 923521 29791 961 923521 1 961 923521 31 31 961 29791 923521 31 923521 31 923521 961 31 961 923521 961 961 923521 923521 92352...

output:

524153120

result:

ok 1 number(s): "524153120"

Test #18:

score: 0
Accepted
time: 17ms
memory: 3864kb

input:

100000
1 1 844561 844561 1 844561 1 919 844561 919 1 844561 919 1 1 844561 1 919 919 1 919 844561 919 1 919 919 919 844561 844561 919 919 1 919 919 919 1 919 1 844561 1 919 919 844561 919 844561 844561 844561 844561 919 1 844561 844561 1 1 844561 1 919 844561 844561 844561 1 919 844561 844561 919 91...

output:

626715414

result:

ok 1 number(s): "626715414"

Test #19:

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

input:

100000
159097 1 159097 159097 1 159097 159097 1 1 1 159097 1 159097 159097 159097 1 159097 1 1 1 159097 1 1 159097 1 159097 159097 1 1 159097 159097 1 159097 159097 1 1 1 1 1 1 1 159097 159097 159097 159097 1 1 1 1 159097 159097 159097 159097 1 159097 159097 1 159097 1 1 1 1 159097 159097 1 159097 1...

output:

25918992

result:

ok 1 number(s): "25918992"

Test #20:

score: 0
Accepted
time: 13ms
memory: 3700kb

input:

100000
521 521 271441 1 271441 1 271441 1 1 521 1 521 1 1 1 521 271441 271441 1 271441 1 271441 1 271441 521 271441 1 1 521 271441 521 271441 521 1 271441 271441 271441 1 271441 271441 271441 521 521 271441 1 521 521 271441 521 521 271441 521 271441 271441 1 521 271441 521 521 521 1 271441 271441 1 ...

output:

713140981

result:

ok 1 number(s): "713140981"

Test #21:

score: 0
Accepted
time: 13ms
memory: 3692kb

input:

100000
256 16 16384 524288 131072 4 16384 4096 4 4096 8192 65536 32 1024 2 8 4 2048 4096 8 65536 512 1024 4 256 16384 256 131072 2 4096 2 2 4096 32768 524288 2048 16 131072 8192 32768 1 2 128 262144 16 32768 131072 2048 32768 8192 262144 32768 1024 262144 131072 4096 128 16 32768 1024 32 32768 16384...

output:

477168076

result:

ok 1 number(s): "477168076"

Test #22:

score: 0
Accepted
time: 1ms
memory: 3816kb

input:

1
136045

output:

1

result:

ok 1 number(s): "1"

Test #23:

score: -100
Wrong Answer
time: 1ms
memory: 3968kb

input:

10
796938 169406 128933 247568 498433 734706 88188 32093 71322 347806

output:

-1077167136

result:

wrong answer 1st numbers differ - expected: '240205168', found: '-1077167136'