QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#50948 | #854. Archer Vlad | tricyzhkx | AC ✓ | 78ms | 3780kb | C++14 | 525b | 2022-09-29 20:18:31 | 2022-09-29 20:18:34 |
Judging History
answer
# include <bits/stdc++.h>
using namespace std;
const double g=10;
pair<double,double> solve(double A,double B,double C)
{
double delta=B*B-4*A*C;
return {(-B-sqrt(delta))/2/A,(-B+sqrt(delta))/2/A};
}
int main()
{
int T;
cin>>T;
while(T--)
{
double v,L=0,R=1e18;
int n,x,y;
scanf("%lf%d",&v,&n);
for(int i=1;i<=n;i++)
{
scanf("%d%d",&x,&y);
auto seg=solve(g*x*x/2/v/v,-x,y+g*x*x/2/v/v);
L=max(L,seg.first);R=min(R,seg.second);
}
printf("%.5lf\n",(L+R)/2);
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3636kb
input:
3 5 1 1 1 5 1 1 1 13 1 7 7
output:
2.50000 2.50000 2.41429
result:
ok OK!
Test #2:
score: 0
Accepted
time: 53ms
memory: 3780kb
input:
15000 793 16 5023 26074 2250 212 5095 26384 7864 30618 2655 18285 8220 30295 8967 14062 1385 10550 2123 483 5949 29841 1133 4219 2799 9397 14596 297 9182 26752 7963 19230 9743 27315 823 20 1236 29918 2106 33247 2170 32933 233 7895 3534 6371 3689 1660 406 2521 2844 24587 3493 8197 1027 25571 3508 598...
output:
8.44234 36.18460 20.57169 273.90986 18.69558 29.06017 110.27783 12.08187 14.51514 13.18339 19.78881 215.75615 83.67310 10.71040 113.55460 15.33905 97.48802 5.11626 101.25178 99.08518 15.61420 152.79640 444.00187 60.89784 44.90982 25.63125 823.81786 34.66888 6.49202 317.57379 29.71618 195.07446 37.20...
result:
ok OK!
Test #3:
score: 0
Accepted
time: 61ms
memory: 3752kb
input:
3 19112 96700 61 1139 1404681 996391 611808 8078391 300933 11496043 153415 6845133 1042621 1458903 543181 10794457 540016 8901506 605856 17717943 601862 17736824 550847 13224828 589935 4906022 1004257 15398146 196961 8477541 1240948 7039907 323244 12250962 1073473 13597516 780105 9198741 1323591 570...
output:
50.44259 24.47043 135.48732
result:
ok OK!
Test #4:
score: 0
Accepted
time: 78ms
memory: 3752kb
input:
300 2226986 999 433999235 186709993 848826471 261170474 799455940 83848717 993614583 969953940 898743613 36130940 748035930 519926360 721067416 477366656 719083956 425975922 28336416 604459608 52425916 861079714 571083926 496364771 155240245 648550377 215332457 745715814 761358368 780244098 95625137...
output:
813.91558 636.20865 3041.70284 2773.20828 500.47675 1071.01911 1062.26101 1148.30815 558.13164 586.46851 204.77162 951.17365 3308.49470 1137.21258 504.84733 369.54982 5507.76923 267.72106 3222.39446 182.59106 4955.53258 1061.09540 1806.54902 339.69952 673.18925 2300.86920 578.93144 275.50129 592.149...
result:
ok OK!