QOJ.ac
QOJ
The 2nd Universal Cup Finals is coming! Check out our event page, schedule, and competition rules!
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#629633 | #8022. Walker | ucup-team3161# | WA | 42ms | 4012kb | C++14 | 790b | 2024-10-11 13:57:34 | 2024-10-11 13:57:37 |
Judging History
answer
#include <bits/stdc++.h>
#define For(i,a,b) for(int i=(a);i<=(b);++i)
using namespace std;
typedef double db;
int main()
{
int T;cin>>T;
while(T--){
db n;
db p1,p2,v1,v2;
cin>>n>>p1>>v1>>p2>>v2;
db res=1e18;
if(p1>p2) swap(p1,p2),swap(v1,v2);
res=min(res,(min(p1,n-p1)+n)/v1);
res=min(res,(min(p2,n-p2)+n)/v2);
db l=p1,r=p2;
auto chk=[&](db k){
db tmp=max((k+min(p1,k-p1))/v1,((n-k)+min(n-p2,p2-k))/v2);
res=min(res,tmp);
return tmp;
};
For(_,1,60){
db mid1=(l*2+r)/3;
db mid2=(l+r*2)/3;
db t1=chk(mid1),t2=chk(mid2);
if(t1>t2) l=mid1;
else r=mid2;
}
printf("%.12lf\n",res);
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3828kb
input:
2 10000.0 1.0 0.001 9999.0 0.001 4306.063 4079.874 0.607 1033.423 0.847
output:
5001000.000017921440 3827.837001376226
result:
ok 2 numbers
Test #2:
score: 0
Accepted
time: 0ms
memory: 3836kb
input:
1 10.0 1.0 10.0 9.0 0.1
output:
1.100000000000
result:
ok found '1.1000000', expected '1.1000000', error '0.0000000'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3996kb
input:
1 10.0 8.0 10.0 9.0 0.1
output:
1.200000000000
result:
ok found '1.2000000', expected '1.2000000', error '0.0000000'
Test #4:
score: 0
Accepted
time: 0ms
memory: 4004kb
input:
1 10.0 8.0 0.1 9.0 10
output:
1.100000000000
result:
ok found '1.1000000', expected '1.1000000', error '0.0000000'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3952kb
input:
1 10.0 2.0 0.1 3.0 10
output:
1.300000000000
result:
ok found '1.3000000', expected '1.3000000', error '0.0000000'
Test #6:
score: 0
Accepted
time: 0ms
memory: 4008kb
input:
1 10.0 9.0 0.1 8.0 10.0
output:
1.200000000000
result:
ok found '1.2000000', expected '1.2000000', error '0.0000000'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3992kb
input:
1 10.0 4.0 0.1 6.0 0.1
output:
60.000000000072
result:
ok found '60.0000000', expected '60.0000000', error '0.0000000'
Test #8:
score: 0
Accepted
time: 0ms
memory: 3932kb
input:
1 10.0 4.5 0.1 6.0 0.1
output:
57.500000000021
result:
ok found '57.5000000', expected '57.5000000', error '0.0000000'
Test #9:
score: 0
Accepted
time: 0ms
memory: 3892kb
input:
1 10.0 1.0 1.0 8.0 1.0
output:
6.500000000003
result:
ok found '6.5000000', expected '6.5000000', error '0.0000000'
Test #10:
score: 0
Accepted
time: 0ms
memory: 3948kb
input:
1 10.0 3.0 2.0 7.0 1.0
output:
4.600000000012
result:
ok found '4.6000000', expected '4.6000000', error '0.0000000'
Test #11:
score: 0
Accepted
time: 0ms
memory: 3844kb
input:
1 10.0 6.0 2.0 7.0 1.0
output:
3.666666666667
result:
ok found '3.6666667', expected '3.6666667', error '0.0000000'
Test #12:
score: 0
Accepted
time: 0ms
memory: 3820kb
input:
1 10.0 1.0 1.0 9.0 1.0
output:
6.000000000014
result:
ok found '6.0000000', expected '6.0000000', error '0.0000000'
Test #13:
score: 0
Accepted
time: 0ms
memory: 4012kb
input:
1 10000.0 1.0 0.001 1.0 0.001
output:
9999000.000000000000
result:
ok found '9999000.0000000', expected '9999000.0000000', error '0.0000000'
Test #14:
score: 0
Accepted
time: 0ms
memory: 3992kb
input:
1 10.0 5.0 1.0 5.0 1.5
output:
5.000000000000
result:
ok found '5.0000000', expected '5.0000000', error '0.0000000'
Test #15:
score: -100
Wrong Answer
time: 42ms
memory: 3832kb
input:
10000 4306.063 4079.874 0.607 1033.423 0.847 8967.336 8026.500 0.398 283.019 0.876 9568.147 4481.616 0.405 800.114 0.684 9867.264 6184.040 0.312 9853.164 0.641 3344.364 730.612 0.539 1305.868 0.947 9336.180 3672.113 0.773 432.686 0.312 1468.243 59.762 0.840 1438.446 0.827 1355.133 1096.314 0.373 109...
output:
3827.837001376226 7999.364992165876 12559.335802716363 15415.544461778467 2637.698519517177 9931.041517550480 934.494301140522 4326.949061662199 5754.032889881489 2847.427157007135 10975.323628219485 2902.179104477611 24531.536363636365 6278.103554873366 1030.000000013394 10734.395644285933 1005.077...
result:
wrong answer 4th numbers differ - expected: '15371.5507020', found: '15415.5444618', error = '0.0028620'