QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#187170 | #3847. Airline | CometoTraval# | WA | 1ms | 4344kb | C++14 | 1.6kb | 2023-09-24 15:06:51 | 2023-09-24 15:06:52 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const double pi=asin(-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<=n;i++)
scanf("%lf",&r[i]);
sort(r+1,r+1+rr);
scanf("%d",&f);
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;
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 = R * cos(da);
int lr = lower_bound(r+1,r+1+rr,r1) - r;
int ll = lr-1;
double ans=1e9;
printf("%.6lf %d\n",da,lr);
if (lr <= rr)
{
ans=min(ans,len(r[lr] * cos(da)-x,r[lr]*sin(da)-y));
}
if (ll > 0)
ans=min(ans,len(r[ll]*cos(da)-x,r[ll]*sin(da)-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: 1ms
memory: 4344kb
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:
-4.013509 1 556.453052827 -3.870825 1 705.390671897 -3.193765 1 767.043675419 -4.498073 1 498.402447827 -3.523673 1 236.019067026 -3.220014 1 651.000768049 -3.549961 1 339.954408708 -3.830572 1 822.650594116 -3.776582 1 1127.840857568 -4.441634 1 837.511193955 -4.498493 1 772.606626945 -3.442026 1 6...
result:
wrong answer 1st lines differ - expected: '8905', found: '-4.013509 1'