QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#576433#9289. 1%-Euclideaneggegg185TL 480ms8808kbC++14690b2024-09-19 20:19:202024-09-19 20:19:20

Judging History

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

  • [2024-11-18 16:44:13]
  • hack成功,自动添加数据
  • (/hack/1194)
  • [2024-09-19 20:19:20]
  • 评测
  • 测评结果:TL
  • 用时:480ms
  • 内存:8808kb
  • [2024-09-19 20:19:20]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
const int B = 70; const double pi = acos(-1);
int n; double ans = 0,s = 0,x[500010],y[500010],tmp[500010];
int main() {
	cin.tie(0)->sync_with_stdio(false);
	cin >> n; for(int i = 1; i <= n; i++) cin >> x[i] >> y[i]; x[0] = 1,y[0] = 0;
	for(int g = 0; g < B; g++) {
		for(int i = 1; i <= n; i++) tmp[i] = x[i];
		sort(tmp+1,tmp+1+n); s += abs(x[0]);
		for(int i = 1; i <= n; i++) ans += (2*i-n-2)*tmp[i];
		for(int i = 0; i <= n; i++) {
			double xx = x[i]*cos(2*pi/B)-y[i]*sin(2*pi/B);
			double yy = x[i]*sin(2*pi/B)+y[i]*cos(2*pi/B);
			x[i] = xx,y[i] = yy;
		}
	}
	cout << fixed << setprecision(10) << ans/s;
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3
-1 2
2 2
-1 -2

output:

11.9937676016

result:

ok error = -0.00052 (-5.19367e-04)

Test #2:

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

input:

4
0 0
2 0
0 2
2 2

output:

13.6514023174

result:

ok error = -0.00040 (-3.99208e-04)

Test #3:

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

input:

10
-5 -9
5 -1
-8 -7
-6 10
1 -2
-1 -6
-2 3
-3 -1
-5 2
-10 9

output:

447.7460164816

result:

ok error = -0.00042 (-4.24159e-04)

Test #4:

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

input:

100
38 5
49 98
51 73
-9 88
85 -17
74 -89
-7 -83
75 -45
-7 -86
-1 -83
64 29
-100 70
94 -31
33 -58
-19 53
-68 -24
-20 -95
-58 -82
96 17
-57 -66
25 -82
33 -88
-30 9
-78 -81
-96 80
-61 98
-70 91
18 -75
-74 -57
-49 46
-30 83
33 -71
97 -36
77 -98
-41 -80
-10 -58
-65 -82
75 -56
71 -99
-79 18
-69 45
85 37
1...

output:

568043.9970309747

result:

ok error = -0.00034 (-3.39672e-04)

Test #5:

score: 0
Accepted
time: 4ms
memory: 8036kb

input:

1000
944 590
-334 904
889 -282
425 -325
-103 -809
993 911
143 443
-932 605
-301 -176
-157 146
-633 -399
-150 955
-363 -14
-817 493
-47 720
-928 -965
-8 -316
272 -299
907 -72
-844 758
642 -52
235 498
-822 204
-224 618
337 55
-809 710
-564 -937
-638 -371
-961 244
-652 408
-298 955
264 -680
-963 -767
-...

output:

519365106.1371605992

result:

ok error = -0.00034 (-3.35605e-04)

Test #6:

score: 0
Accepted
time: 40ms
memory: 8056kb

input:

10000
-659 -2844
-8357 -6691
-1461 -3785
-2767 2416
-8822 1703
9241 -2262
-1504 -3990
6987 -5208
2984 -9116
7244 2503
-6187 6720
-1624 -931
6738 -7167
2962 -4352
-6964 -8792
6241 -582
-6450 -1229
2177 -1269
1714 -3459
-7260 -8263
6329 5496
9797 -8972
927 -5671
-2721 3134
9392 5161
-5527 -2240
-983 7...

output:

520414285182.4296875000

result:

ok error = -0.00034 (-3.35679e-04)

Test #7:

score: 0
Accepted
time: 480ms
memory: 8808kb

input:

100000
-83701 75196
45765 -6235
36272 37275
-35366 -82843
8306 -1369
-28173 46051
-65089 -8781
75824 -54559
-55700 -93735
59743 86007
-72405 -47645
24812 35094
-4454 -21204
-35485 87381
28200 45650
904 -80565
38488 14842
10353 48050
66074 7042
61753 71952
55030 -92952
-44662 -94767
-59269 -34289
374...

output:

520806723242921.5000000000

result:

ok error = -0.00034 (-3.35666e-04)

Test #8:

score: -100
Time Limit Exceeded

input:

500000
-583904 203313
-340892 -796716
910437 -246461
-246636 206026
-735478 953404
746547 -77553
-661769 967977
-312048 -680490
-776092 95714
140302 677488
-907238 962373
-225267 107163
714274 -295282
430205 384021
-737797 -503077
871316 171099
-234497 -767343
-149102 399526
912881 -921105
-831662 6...

output:


result: