QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#805238 | #9869. Horizon Scanning | dashenaaa# | WA | 0ms | 4280kb | C++20 | 907b | 2024-12-08 14:50:59 | 2024-12-08 14:51:00 |
Judging History
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
#define eps 1e-9
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]+eps)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();
}
详细
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 4280kb
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 6.283185307
result:
wrong answer 5th numbers differ - expected: '3.1415927', found: '6.2831853', error = '1.0000000'