QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#697150#1842. Mathship2077WA 7ms3956kbC++14465b2024-11-01 11:22:042024-11-01 11:22:10

Judging History

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

  • [2024-11-01 11:22:10]
  • 评测
  • 测评结果:WA
  • 用时:7ms
  • 内存:3956kb
  • [2024-11-01 11:22:04]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
constexpr int m=1e6,M=1e6+5;
int n,buc[M];long long ans;
int read(){
	int x=0;char ch=getchar();
	while (!isdigit(ch)) ch=getchar();
	while (isdigit(ch)) x=x*10+ch-48,ch=getchar();
	return x;
}
int main(){ n=read();
	for (int i=1;i<=n;i++) buc[read()]++;
	for (int i=1;i<=m;i++)
		for (int j=i&1?1:2,limit=min(i-1,m/i);j<=limit;j+=2)
			ans+=1ll*buc[i*j]*buc[i+j>>1];
	printf("%lld\n",ans);
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 7ms
memory: 3828kb

input:

5
1 2 3 4 5

output:

2

result:

ok 1 number(s): "2"

Test #2:

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

input:

1
1

output:

0

result:

ok 1 number(s): "0"

Test #3:

score: -100
Wrong Answer
time: 6ms
memory: 3956kb

input:

5
6 4 7 3 5

output:

2

result:

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