QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#811091 | #9869. Horizon Scanning | Nana7# | WA | 92ms | 6212kb | C++14 | 1.1kb | 2024-12-12 15:21:06 | 2024-12-12 15:21:07 |
Judging History
answer
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#define I inline
using namespace std;
const double PI = 3.141592653;
const double eps = 1e-7;
const int N = 200100;
struct point {
int x,y;
}a[N<<1];
char s[N];
int p[N];
int n,m,k;
I double rate(point p1,point p2) {
double a1=atan2(p1.y,p1.x),a2=atan2(p2.y,p2.x);
if(a2-a1<-eps) return a2-a1+PI*2;
return a2-a1;
}
I bool cmp(point p1,point p2) {
return atan2(p1.y,p1.x)<atan2(p2.y,p2.x);
}
I void solve() {
cin>>n>>k;
for(int i=1;i<=n;++i) cin>>a[i].x>>a[i].y;
if(n==1) {
cout<< "6.2831853072"<<endl;
return ;
}
sort(a+1,a+1+n,cmp);
for(int i=n+1;i<=n*2;++i) a[i]=a[i-n];
double ans=0;
for(int i=1;i<=n;++i) {
point l=a[i],r=a[i+k];
double rr=rate(l,r);
ans=max(ans,rr);
}
printf("%.6lf\n",ans);
//cout<<ans<<endl;
}
int main()
{
int T; cin>>T;
while(T--) {
solve();
}
}
/*
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
*/
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 6112kb
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.570796 5.497787 3.141593 3.141593
result:
ok 5 numbers
Test #2:
score: -100
Wrong Answer
time: 92ms
memory: 6212kb
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.692991 2.574863 4.652758 2.772633 5.742766 4.857699 3.419892 2.812800 0.000000 0.000000 5.117281 6.146783 3.842089 2.342497 3.463343 0.000000 5.961435 3.324703 5.262775 5.672459 1.673878 1.114191 2.408778 0.000000 5.355890 3.799861 4.193243 4.051346 4.534296 4.361235 1.876019 1.996726 5.553286 3.7...
result:
wrong answer 9th numbers differ - expected: '6.2831853', found: '0.0000000', error = '1.0000000'