QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#554117 | #9253. Prism Palace | acceon128# | AC ✓ | 130ms | 4856kb | C++23 | 1.6kb | 2024-09-09 06:34:25 | 2024-09-09 06:34:27 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const long double PI = acos(-1);
typedef pair<int, int> pi;
typedef long long ll;
typedef long double ld;
pi operator -(const pi &a, const pi &b) {
return {a.first - b.first, a.second - b.second};
}
int main() {
int n;
cin >> n;
vector<pi> points(n);
for (auto& point : points) {
cin >> point.first >> point.second;
}
ld ans = 0.0;
for (int i = 0; i < n; ++i) {
int prev = (i - 1 + n) % n;
int nxt1 = (i + 1) % n;
int nxtt = (i + 2) % n;
pi vector1 = points[prev] - points[i];
pi vector2 = points[nxt1] - points[i];
pi vector3 = points[nxtt] - points[nxt1];
pi vector4 = points[i] - points[nxt1];
ll dot1 = ll(vector1.first) * vector2.first + ll(vector1.second) * vector2.second;
ll dot2 = ll(vector3.first) * vector4.first + ll(vector3.second) * vector4.second;
ld length1 = sqrtl(ll(vector1.first) * vector1.first + ll(vector1.second) * vector1.second);
ld length2 = sqrtl(ll(vector2.first) * vector2.first + ll(vector2.second) * vector2.second);
ld length3 = sqrtl(ll(vector3.first) * vector3.first + ll(vector3.second) * vector3.second);
ld length4 = sqrtl(ll(vector4.first) * vector4.first + ll(vector4.second) * vector4.second);
ld angle1 = acos(dot1 / (length1 * length2));
ld angle2 = acos(dot2 / (length3 * length4));
ans += max((ld)0, PI - (angle1 + angle2));
}
cout << fixed << setprecision(18) << ans / PI << '\n';
return 0;
}
这程序好像有点Bug,我给组数据试试?
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3876kb
input:
3 0 0 1 0 0 1
output:
0.999999999999999922
result:
ok found '1.0000000', expected '1.0000000', error '0.0000000'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3900kb
input:
4 0 0 0 1 1 1 1 0
output:
0.000000000000000000
result:
ok found '0.0000000', expected '0.0000000', error '-0.0000000'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3892kb
input:
4 0 0 0 3 1 2 1 1
output:
0.499999999999999981
result:
ok found '0.5000000', expected '0.5000000', error '0.0000000'
Test #4:
score: 0
Accepted
time: 126ms
memory: 4688kb
input:
199996 719157942 80035870 719158808 80033199 719160795 80027070 719162868 80020675 719165635 80012139 719166422 80009711 719166927 80008153 719168388 80003645 719168539 80003179 719168806 80002355 719168864 80002176 719169119 80001389 719171067 79995376 719173806 79986921 719175195 79982633 71917686...
output:
0.000077716803490365
result:
ok found '0.0000777', expected '0.0000777', error '0.0000000'
Test #5:
score: 0
Accepted
time: 126ms
memory: 4856kb
input:
199999 521578765 315995242 521578784 315995230 521585008 315991299 521590377 315987908 521597318 315983524 521606119 315977965 521610976 315974897 521614329 315972779 521622922 315967351 521631939 315961655 521636172 315958981 521638241 315957674 521643115 315954595 521650976 315949629 521656567 315...
output:
0.000096532179352676
result:
ok found '0.0000965', expected '0.0000965', error '0.0000000'
Test #6:
score: 0
Accepted
time: 126ms
memory: 4676kb
input:
200000 88808852 208512084 88810113 208513562 88812008 208515783 88812543 208516410 88816806 208521406 88824507 208530431 88825624 208531740 88831723 208538887 88834262 208541862 88838287 208546578 88845440 208554959 88848801 208558897 88855564 208566821 88856869 208568350 88862876 208575388 88868324...
output:
0.000074373701295571
result:
ok found '0.0000744', expected '0.0000744', error '0.0000000'
Test #7:
score: 0
Accepted
time: 130ms
memory: 4756kb
input:
199998 2857588 37580055 2857908 37582176 2857951 37582461 2858026 37582958 2859295 37591366 2859678 37593903 2860879 37601857 2862301 37611272 2862330 37611464 2863054 37616255 2864429 37625353 2865434 37632002 2865585 37633001 2867092 37642971 2867321 37644486 2867870 37648118 2868343 37651247 2868...
output:
0.000067539683444487
result:
ok found '0.0000675', expected '0.0000675', error '0.0000000'
Test #8:
score: 0
Accepted
time: 126ms
memory: 4732kb
input:
199999 487716180 333296644 487720319 333294576 487721706 333293883 487731571 333288954 487734599 333287441 487742738 333283374 487744419 333282534 487746174 333281657 487748301 333280594 487750462 333279514 487754846 333277323 487759670 333274912 487762097 333273699 487764676 333272410 487772963 333...
output:
0.000070696701786680
result:
ok found '0.0000707', expected '0.0000707', error '0.0000000'
Extra Test:
score: 0
Extra Test Passed