QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#554404 | #9253. Prism Palace | ucup-team1264 | WA | 31ms | 6316kb | C++20 | 1.3kb | 2024-09-09 11:04:32 | 2024-09-09 11:04:35 |
Judging History
answer
// https://www.youtube.com/watch?v=R0P_f0gXXqs
// I could feel your heartbeat
// I could feel somewhere you’re looking down
// ‘Cause it’s you who I’m loving
// And it’s you that I want in need
#ifndef ONLINE_JUDGE
#include "templates/debug.hpp"
#else
#define debug(...)
#endif
#include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
using u64 = uint64_t;
void solve() {
int n; cin >> n;
double ans = 0.0;
vector<pair<int, int>> p(n);
for (int i = 0; i < n; i++) {
cin >> p[i].first >> p[i].second;
}
vector<double> angles(n);
for (int i = 0; i < n; i++) {
double x1 = p[(i-1+n)%n].first - p[i].first;
double y1 = p[(i-1+n)%n].second - p[i].second;
double x2 = p[(i+1)%n].first - p[i].first;
double y2 = p[(i+1)%n].second - p[i].second;
angles[i] = abs(atan2(y2, x2) - atan2(y1, x1));
}
using numbers::pi;
for (int i = 0; i < n; i++) {
double a = angles[i], b = angles[(i+1)%n];
if (a + b < pi) {
ans += (pi - a - b) / pi;
}
}
cout << fixed << setprecision(10) << ans << endl;
}
// Make bold hypotheses and verify carefully
int main() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
int t = 1;
// cin >> t;
while (t--) {
solve();
};
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 4224kb
input:
3 0 0 1 0 0 1
output:
1.0000000000
result:
ok found '1.0000000', expected '1.0000000', error '0.0000000'
Test #2:
score: 0
Accepted
time: 0ms
memory: 4104kb
input:
4 0 0 0 1 1 1 1 0
output:
0.0000000000
result:
ok found '0.0000000', expected '0.0000000', error '-0.0000000'
Test #3:
score: 0
Accepted
time: 0ms
memory: 4228kb
input:
4 0 0 0 3 1 2 1 1
output:
0.5000000000
result:
ok found '0.5000000', expected '0.5000000', error '0.0000000'
Test #4:
score: -100
Wrong Answer
time: 31ms
memory: 6316kb
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.0000000000
result:
wrong answer 1st numbers differ - expected: '0.0000777', found: '0.0000000', error = '0.0000777'