QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#821720#9869. Horizon ScanningtselmegkhWA 1ms4168kbC++14953b2024-12-19 17:34:502024-12-19 17:34:50

Judging History

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

  • [2024-12-19 17:34:50]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:4168kb
  • [2024-12-19 17:34:50]
  • 提交

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'