QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#821720 | #9869. Horizon Scanning | tselmegkh | WA | 1ms | 4168kb | C++14 | 953b | 2024-12-19 17:34:50 | 2024-12-19 17:34:50 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
double pi = acos(-1.0);
double eps = 1e-9;
void solve() {
int n, k;
cin >> n >> k;
vector<pair<double, pair<int, int>>> a(n);
for(int i = 0; i < n; i++){
cin >> a[i].second.first >> a[i].second.second;
a[i].first = atan2(a[i].second.second, a[i].second.first);
}
if(abs(a[0].first - a.back().first) < eps) {
cout << fixed << setprecision(10) << 2 * pi << '\n';
return;
}
sort(a.begin(), a.end());
double mx = 0.0;
for(int i = 0; i < n; i++) {
int j = (i + k) % n;
double x = a[j].first - a[i].first;
if(x <= eps){
x += 2 * pi;
}
mx = max(mx, x);
}
cout << fixed << setprecision(10) << mx << '\n';
}
int main() {
ios::sync_with_stdio(0); cin.tie(nullptr);
int t = 1;
cin >> t;
while(t--) {
solve();
}
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 4168kb
input:
5 1 1 0 1 8 2 1 0 1 1 0 1 -1 1 -1 0 -1 -1 0 -1 1 -1 4 2 -1 1 0 1 0 2 1 1 4 2 -1000000000 0 -998244353 1 998244353 1 1000000000 0 3 1 0 1 0 2 0 -1
output:
6.2831853072 1.5707963268 5.4977871438 3.1415926546 6.2831853072
result:
wrong answer 5th numbers differ - expected: '3.1415927', found: '6.2831853', error = '1.0000000'