QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#576811 | #9289. 1%-Euclidean | hhoppitree | RE | 391ms | 7224kb | C++17 | 845b | 2024-09-19 22:36:36 | 2024-09-19 22:36:40 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5, B = 55;
const double PI = acos(-1.0);
int x[N], y[N];
double res[N];
pair<double, int> tq[N];
signed main() {
int n; scanf("%d", &n);
for (int i = 1; i <= n; ++i) scanf("%d%d", &x[i], &y[i]);
for (int i = 0; i < B; ++i) {
double s1 = cos(2 * PI * i / B), s2 = sin(2 * PI * i / B), now = 0;
for (int j = 1; j <= n; ++j) tq[j] = make_pair(s1 * x[j] - s2 * y[j], j);
sort(tq + 1, tq + n + 1);
for (int j = 1; j <= n; ++j) res[tq[j].second] += j * tq[j].first - (now += tq[j].first);
now = 0;
for (int j = n; j; --j) res[tq[j].second] += (now += tq[j].first) - (n - j + 1) * tq[j].first;
}
printf("%.6lf\n", accumulate(res + 1, res + n + 1, (double)0) / B * PI / 4.0);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 6216kb
input:
3 -1 2 2 2 -1 -2
output:
11.999553
result:
ok error = -0.00004 (-3.72500e-05)
Test #2:
score: 0
Accepted
time: 0ms
memory: 4164kb
input:
4 0 0 2 0 0 2 2 2
output:
13.656503
result:
ok error = -0.00003 (-2.57196e-05)
Test #3:
score: 0
Accepted
time: 0ms
memory: 4236kb
input:
10 -5 -9 5 -1 -8 -7 -6 10 1 -2 -1 -6 -2 3 -3 -1 -5 2 -10 9
output:
447.937345
result:
ok error = 0.00000 (2.97444e-06)
Test #4:
score: 0
Accepted
time: 1ms
memory: 4232kb
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:
568239.221111
result:
ok error = 0.00000 (3.88891e-06)
Test #5:
score: 0
Accepted
time: 3ms
memory: 4200kb
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:
519539542.482176
result:
ok error = 0.00000 (1.47304e-07)
Test #6:
score: 0
Accepted
time: 29ms
memory: 4480kb
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:
520589021455.197266
result:
ok error = -0.00000 (-2.77175e-08)
Test #7:
score: 0
Accepted
time: 391ms
memory: 7224kb
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:
520981598830352.812500
result:
ok error = -0.00000 (-5.96367e-10)
Test #8:
score: -100
Runtime Error
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...