QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#811099 | #9869. Horizon Scanning | Nana7# | WA | 1ms | 6212kb | C++14 | 1.2kb | 2024-12-12 15:27:01 | 2024-12-12 15:27:02 |
Judging History
answer
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#define I inline
#define double long double
using namespace std;
const double PI = 3.14159265358;
const double eps = 1e-8;
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,int cro) {
double a1=atan2(p1.y,p1.x),a2=atan2(p2.y,p2.x);
//cout<<a1<<' '<<a2<<' '<<cro<<endl;
if(cro) 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,i+k>n);
ans=max(ans,rr);
cout<<"!!"<<rr<<endl;
}
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: 0
Wrong Answer
time: 1ms
memory: 6212kb
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.5708 !!1.5708 !!1.5708 !!1.5708 !!1.5708 !!1.5708 !!1.5708 !!1.5708 1.570796 !!0.785398 !!0.785398 !!5.49779 !!5.49779 5.497787 !!3.14159 !!3.14159 !!3.14159 !!3.14159 3.141593 !!3.14159 !!0 !!3.14159 3.141593
result:
wrong output format Expected double, but "!!1.5708" found