QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#805231#9869. Horizon Scanningdashenaaa#WA 12ms4228kbC++20886b2024-12-08 14:48:022024-12-08 14:48:03

Judging History

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

  • [2024-12-08 14:48:03]
  • 评测
  • 测评结果:WA
  • 用时:12ms
  • 内存:4228kb
  • [2024-12-08 14:48:02]
  • 提交

answer

#include<bits/stdc++.h>
#define pi pair<int,int>
#define pb push_back
#define vec vector<int>
using namespace std;
#define int long long
#define M 998244353
void in(int &x){
    int f=1;x=0;
    char c=getchar();
    while(!isdigit(c)&&c!='-')c=getchar();
    if(c=='-')f=-1,c=getchar();
    while(isdigit(c))x=x*10+c-'0',c=getchar();
    x*=f;
}
int t,n,m,k,x,y;
double a[2000005];
void solve(){
    in(n);in(m);
    for(int i=1;i<=n;i++){
        in(x);in(y);
        a[i]=atan2(y,x);
    }
    sort(a+1,a+1+n);for(int i=1;i<=n;i++)a[i+n]=a[i];
    double ans=0,p=2*acos(-1.0);
    if(m==n){
        printf("%.9lf\n",p);
        return;
    }
    for(int i=1;i<=n;i++){
        if(a[i+m]>=a[i])ans=max(ans,a[i+m]-a[i]);
        else ans=max(ans,a[i+m]-a[i]+p);
    }
    printf("%.9lf\n",ans);
}
signed main(){
    in(t);
    while(t--)solve();
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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.283185307
1.570796327
5.497787144
3.141592655
3.141592654

result:

ok 5 numbers

Test #2:

score: -100
Wrong Answer
time: 12ms
memory: 4228kb

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.692991497
2.574863436
4.652758267
2.772633107
5.742765807
4.857698991
3.419892313
2.812799962
6.283185307
6.283185307
5.117280767
6.146782703
3.842089024
2.342496717
3.463343208
6.283185307
5.961434753
3.324703471
5.262774928
5.672459343
1.673877935
1.114190855
2.408777552
6.283185307
5.355890089
...

result:

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