QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#317096#8177. Sum is Integergrass8cow#WA 50ms10036kbC++17691b2024-01-28 15:06:352024-01-28 15:06:35

Judging History

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

  • [2024-01-28 15:06:35]
  • 评测
  • 测评结果:WA
  • 用时:50ms
  • 内存:10036kb
  • [2024-01-28 15:06:35]
  • 提交

answer

#include<bits/stdc++.h>
#define lb long double
using namespace std;
int n;
const lb PI=acos(-1.0);
struct qq{lb a,b;};
const lb eps=1e-10;
qq operator * (const qq &x,const qq &y){return (qq){x.a*y.a-x.b*y.b,x.a*y.b+x.b*y.a};}
qq a[200100];
int main(){
	qq e=(qq){1,0};
	a[0]=e;
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		int p,q;scanf("%d%d",&p,&q);
		lb O=PI*2*p/q;
		e=e*((qq){cos(O),sin(O)});
		a[i]=e;
	}
	sort(a,a+n+1,[&](qq a,qq b){if(abs(a.a-b.a)<eps)return a.b<b.b;return a.a<b.a;});
	long long ans=0;
	for(int i=0,j=0;i<=n;i++){
		j++;
		if(i==n||abs(a[i+1].a-a[i].a)>eps||abs(a[i+1].b-a[i].b)>eps)ans+=1ll*j*(j-1)/2,j=0;
	}
	return printf("%lld",ans),0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3796kb

input:

4
1 6
1 3
1 2
1 2

output:

2

result:

ok "2"

Test #2:

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

input:

5
1 1
2 2
3 3
4 4
5 5

output:

15

result:

ok "15"

Test #3:

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

input:

2
1 99999
99999 100000

output:

0

result:

ok "0"

Test #4:

score: -100
Wrong Answer
time: 50ms
memory: 10036kb

input:

200000
82781 82781
86223 86223
16528 16528
84056 84056
94249 94249
54553 54553
25943 25943
10415 10415
52417 52417
46641 46641
70298 70298
84228 84228
55441 55441
49326 49326
11753 11753
89499 89499
58220 58220
71482 71482
32373 32373
7251 7251
78573 78573
74268 74268
46682 46682
20314 20314
85519 8...

output:

19799405515

result:

wrong answer 1st words differ - expected: '10603308211', found: '19799405515'