QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#803941 | #9869. Horizon Scanning | ucup-team5697# | WA | 34ms | 3936kb | C++14 | 840b | 2024-12-07 19:34:04 | 2024-12-07 19:34:12 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;bool Mbe;
namespace MAOJUN{
typedef long double db;
const int N=2e5+5;
int n,k;db a[N];
const db pi=acos(-1);
inline void slv(){
scanf("%d%d",&n,&k);
for(int i=0;i<n;i++){
db x,y;scanf("%Lf%Lf",&x,&y);a[i]=atan2l(x,y);
}
// for(int i=0;i<n;i++)printf("%Lf ",a[i]);puts("");
if(n==k){printf("%Lf\n",2*pi);return;}
sort(a,a+n);
db mx=0;
for(int i=0;i<n;i++){
db w=a[(i+k)%n]-a[i];
if(w<0)mx=max(mx,w+2*pi);
else mx=max(mx,w);
}
printf("%Lf\n",mx);
}
inline void main(){int T;scanf("%d",&T);while(T--)slv();}
}bool Med;int main(){
#ifdef LOCAL
freopen("1.in","r",stdin);
freopen("data.out","w",stdout);
atexit([]{fprintf(stderr,"%.0lfms\n%lfMB\n",clock()*1000./CLOCKS_PER_SEC,(&Mbe-&Med)/1024./1024);});
#endif
MAOJUN::main();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3888kb
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.283185 1.570796 5.497787 3.141593 3.141593
result:
ok 5 numbers
Test #2:
score: -100
Wrong Answer
time: 34ms
memory: 3936kb
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 6.283185 6.283185 5.117281 6.146783 3.842089 2.342497 3.463343 6.283185 5.961435 3.324703 5.262775 5.672459 1.673878 1.114191 2.408778 6.283185 5.355890 3.799861 4.193243 4.051346 4.534296 4.361235 1.876019 1.996726 5.553286 3.7...
result:
wrong answer 42nd numbers differ - expected: '6.2831853', found: '6.2599340', error = '0.0037006'