QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#187201 | #3847. Airline | CometoTraval# | WA | 25ms | 5692kb | C++14 | 1.7kb | 2023-09-24 15:26:20 | 2023-09-24 15:26:20 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const double pi=acos(-1);
const double eps=1e-9;
double sqr(double x)
{
return x*x;
}
double len(double x,double y)
{
return sqrt(sqr(x)+sqr(y));
}
double r[100010],an[100010];
int main()
{
int rr,f,n;
scanf("%d%d%d",&rr,&f,&n);
for (int i=1;i<=rr;i++)
scanf("%lf",&r[i]);
sort(r+1,r+1+rr);
for (int i=1;i<=f;i++)
{
double x,y;
scanf("%lf%lf",&x,&y);
an[i] = atan2(y,x);
if (an[i] < -eps) an[i]+=pi*2;
}
sort(an+1,an+1+f);
for (int i=1;i<=f;i++)
an[i+f] = an[i] + pi*2;
while (n--)
{
double x,y;
scanf("%lf%lf",&x,&y);
double ang = atan2(y,x);
if (ang<-eps) ang+=pi*2;
double R = sqrt(sqr(x)+sqr(y));
int ar = lower_bound(an+1,an+1+f*2,ang) - an;
int al = ar-1;
if (al == 0) al == f*2;
int ca;
double da;
double dr = an[ar] - ang;
double dl = ang - an[al];
if (dr < -eps) dr+=2*pi;
if (dr > 2*pi) dr-=2*pi;
if (dl < -eps) dl+=2*pi;
if (dl > 2*pi) dl-=2*pi;
if (dl < dr) ca = al,da = dl;
else ca = ar,da = dr;
double r1 = abs(R * cos(da));
int lr = lower_bound(r+1,r+1+rr,r1) - r;
int ll = lr-1;
double ans=1e9;
printf("%.6lf %d %.6lf %.6lf\n",da,ca,r[lr],r[ll]);
if (lr <= rr)
ans=min(ans,len(r[lr]*cos(an[ca])-x,r[lr]*sin(an[ca])-y));
printf("%lld\n",ans);
if (ll > 0)
ans=min(ans,len(r[ll]*cos(an[ca])-x,r[ll]*sin(an[ca])-y));
printf("%.9lf\n",ans);
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 25ms
memory: 5692kb
input:
1000 100000 552 9 456 720 540 790 628 695 848 478 66 268 798 360 773 277 116 471 874 792 912 784 502 831 359 965 925 434 677 629 271 670 76 755 92 200 814 422 922 266 617 44 480 331 18 662 153 753 669 491 368 187 99 867 476 808 774 509 98 147 724 478 447 182 923 469 881 665 674 589 770 613 436 310 8...
output:
0.000000 61000 6.302335 6.302335 0 957.000836572 0.000000 64927 6.302335 6.302335 0 1044.539708503 0.000001 20204 6.302335 6.302335 0 831.703035098 0.000000 30157 6.302335 6.302335 0 737.001102553 0.000000 75643 6.302335 6.302335 0 115.340585244 0.000000 99473 6.302335 6.302335 0 153.710164699 0.000...
result:
wrong answer 1st lines differ - expected: '8905', found: '0.000000 61000 6.302335 6.302335'