QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#816793#9869. Horizon ScanningWaveletWA 50ms4308kbC++14898b2024-12-16 18:10:062024-12-16 18:10:07

Judging History

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

  • [2024-12-16 18:10:07]
  • 评测
  • 测评结果:WA
  • 用时:50ms
  • 内存:4308kb
  • [2024-12-16 18:10:06]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define max_len 200010
double arr[max_len];
int N;
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
double get_cha(double beg, double end)
{
    if(beg <= end)
    {
        return end - beg;
    }
    else
    {
        return 2 * M_PI + end - beg;
    }
}
void sol()
{
    int k;
    cin >> N >> k;
    for (int i = 0; i < N; i++)
    {
        int a, b;
        cin >> a >> b;
        arr[i] = atan2(b, a);
    }
    sort(arr, arr + N);
    if(N == k)
    {
        printf("%.8lf\n", M_PI * 2);
        return;
    }
    double ans = 0;
    for (int i = 0; i < N; i++)
    {
        ans = max(ans, get_cha(arr[i], arr[(i + k) % N]));
    }
    //cout << ans << "\n";
    printf("%.8lf\n", ans);
    
}
int main()
{
    int T;
    cin >> T;
    while (T--)
    {
        sol();
    }
    
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 4308kb

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.28318531
1.57079633
5.49778714
3.14159265
3.14159265

result:

ok 5 numbers

Test #2:

score: -100
Wrong Answer
time: 50ms
memory: 4156kb

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.69299150
2.57486344
4.65275827
2.77263311
5.74276581
4.85769899
3.41989231
2.81279996
6.28318531
6.28318531
5.11728077
6.14678270
3.84208902
2.34249672
3.46334321
6.28318531
5.96143475
3.32470347
5.26277493
5.67245934
1.67387794
1.11419085
2.40877755
6.28318531
5.35589009
3.79986062
4.19324287
4.0...

result:

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