QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#820932#9869. Horizon Scanningqsmcgogo#WA 6ms38676kbC++201.5kb2024-12-19 10:13:492024-12-19 10:13:55

Judging History

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

  • [2024-12-19 10:13:55]
  • 评测
  • 测评结果:WA
  • 用时:6ms
  • 内存:38676kb
  • [2024-12-19 10:13:49]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
int a[1110110],b[1101010],c[1100110],d[202020];
string s[1010100];
vector<int>g[202020];
pair<int,int>p[202020];

double pi=acos(-1);
double f(pair<int,int>a){
  if(a.second==0){
    if(a.first>0){
      return 0;
    }
    return pi;
  }
  double d=sqrt((double)a.second*a.second+a.first*a.first);
  double th=acos((double)1.0*a.first/d);
  if(a.second>0){
    return th;
  }
  return 2*pi-th;
}
bool cmp(pair<int,int>a,pair<int,int>b){
  return f(a)<f(b);
}
signed main(){
  //  ios::sync_with_stdio(false);cin.tie(0);
//    cout<<acos(1)<<" "<<acos(-1)<<'\n';
    int _=1;
    cin>>_;
    pi=3.1415926535897932384626;
    // printf("%.18Lf\n",pi);
    int i,j;
    int n;
    while(_--){
        int n,m,l,k,w;
        string s;
        cin>>n>>k;
        for(i=0;i<n;i++){
          cin>>p[i].first>>p[i].second;
        //  printf("%.15Lf\n",f(p[i]));
        }
        if(n==k){
          printf("%.10Lf\n",2*pi);
          continue;
        }
        sort(p,p+n,cmp);
        double ma=0;
       // k=n-k;
      //  k++;
        for(i=k;i<2*n;i++){
          double temp=f(p[i%n])-f(p[(i-k)%n]);
       //   cout<<temp<<'\n';
          if(temp<=0.000000000000000001)temp+=2*pi;
          ma=max(ma,temp);
        }
       // cout<<ma<<'\n';
        printf("%.10Lf\n",ma);
        

       
        
    }

    
    

}

/*

3

2 3 1

3 1 2

2 1 3


*/

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 6ms
memory: 38676kb

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'