QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#802311#9869. Horizon Scanningucup-team3802#WA 75ms3956kbC++20816b2024-12-07 13:22:262024-12-07 13:22:32

Judging History

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

  • [2024-12-07 13:22:32]
  • 评测
  • 测评结果:WA
  • 用时:75ms
  • 内存:3956kb
  • [2024-12-07 13:22:26]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define all(a) a.begin(), a.end()
#define rep(i, a, b) for(ll i = a; i < b; i++)

const ld PI = acosl(-1);
const ld PI2 = PI * 2;

ld mod_PI2(ld x){
    while(x < 0) x += PI2;
    while(x >= PI2) x -= PI2;
    return x;
}

void solve(){
    int n,k;
    cin >> n >> k;
    vector<ld> angle(n);
    rep(i,0,n){
        ld x,y;
        cin >> x >> y;
        angle[i] = atan2l(y, x);
    }
    sort(all(angle));

    ld ans = 0;
    rep(i,0,n){
        ans = max(ans, mod_PI2(angle[(i+k)%n] - angle[i]));
    }
    if(ans == 0) ans = PI2;

    cout << fixed << setprecision(20);
    cout << ans << endl;
}

int main(){
    int t;
    cin >> t;
    while(t--){
        solve();
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3820kb

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.28318530717958647703
1.57079632679489661936
5.49778714378213816723
3.14159265459155197329
3.14159265358979323851

result:

ok 5 numbers

Test #2:

score: -100
Wrong Answer
time: 75ms
memory: 3956kb

input:

10000
16 1
-10 -6
-5 -6
-4 9
-2 5
-2 10
1 -7
1 -5
1 6
3 1
4 -9
6 -10
6 -3
6 1
8 -5
8 -4
9 -4
17 4
-9 2
-8 -4
-8 -3
-8 -1
-6 -2
-6 -1
-6 8
-5 -8
-5 10
-4 8
-2 -8
4 -9
4 0
5 -3
8 -5
9 -2
10 10
10 6
-7 2
-4 6
-2 -7
-2 -1
-1 7
1 -9
1 8
3 -4
7 -4
9 -2
14 3
-9 10
-8 -10
-8 -8
-6 -7
-6 -5
-1 -7
-1 -2
0 -1
...

output:

1.69299149748625167361
2.57486343606628689091
4.65275826725352046860
2.77263310738393677383
5.74276580690900232155
4.85769899102039198454
3.41989231259490458975
2.81279996208483885922
6.28318530717958647703
6.28318530717958647703
5.11728076666977328094
6.14678270277863904834
3.84208902353751959730
2...

result:

wrong answer 42nd numbers differ - expected: '6.2831853', found: '6.2599337', error = '0.0037006'