QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#617584#8022. WalkerOkuchiriWA 11ms3928kbC++202.7kb2024-10-06 16:18:392024-10-06 16:18:42

Judging History

你现在查看的是最新测评结果

  • [2024-10-06 16:18:42]
  • 评测
  • 测评结果:WA
  • 用时:11ms
  • 内存:3928kb
  • [2024-10-06 16:18:39]
  • 提交

answer

#include<bits/stdc++.h>
#define ll long long
#define ld double
#define mod 998244353
using namespace std;
ld n,a,b,v1,v2;
void work()
{
    cin>>n>>a>>v1>>b>>v2;
    
    if(a>b)
    {
        swap(a,b);
        swap(v1,v2);
    }
    ld a1=a,b1=n-b;
    ld ans=min((a+n)/v1,(b+n)/v2);
    ans=min({(n-a+n)/v1,(n-b+n)/v2,ans});
    
    ans=min(ans, max(a/v1,    min((2*(b-a)+n-b)/v2,(2*(n-b)+b-a)/v2)));
    ans=min(ans, max((n-b)/v2,min((2*a+b-a)/v1,(2*(b-a)+a)/v1)));
    if(2*a1<=n-2*b1)
    {
        ld x=(2*v1*b1+(b-a1)*v1-v2*a1)/(2*v2+v1);
        if(x>=0&&x<=a1)
        {
            ans=min(ans,(a1+2*x)/v1);
        }
        ans=min(ans,max(3*a1/v1,(2*b1+b-2*a1)/v2));
        x=(2*b1*v1+(b-a1)*v1-2*a1*v2)/(v1+v2);
        if(x>=a1&&x<=b-a-b1)
        {
            ans=min(ans,(2*a1+x)/v1);
        }
        ans=min(ans,max(3*b1/v2,(2*a1+b-a-b1)/v1));
        x=(v1*b1+2*(b-a1)*v1-2*a1*v2)/(v2+2*v1);
        if(x>=b-a-b1&&x<=b-a)
        {
            ans=min(ans,(2*a1+x)/v1);
        }
    }
    else if(a+a1<=b&&n-2*b1>=a)
    {
        ld x=(2*v1*b1+(b-a1)*v1-v2*a1)/(2*v2+v1);
        if(x>=0&&x<=b-a-b1)
        {
            ans=min(ans,(a1+2*x)/v1);
        }
        ans=min(ans,max(3*b1/v2,(2*(b-a-b1)+a)/v1));
        x=(v1*b1+2*(b-a1)*v1-v2*a1)/(2*v2+2*v1);
        if(x>=b-a-b1&&x<=a1)
        {
            ans=min(ans,(a1+2*x)/v1);
        }
        ans=min(ans,max(3*a1/v1,(2*(b-2*a1)+b1)/v2));
        x=(v1*b1+2*(b-a1)*v1-2*a1*v2)/(v2+2*v1);
        if(x>=a1&&x<=b-a)
        {
            ans=min(ans,(x+2*a1)/v1);
        }
    }
    else if(b-b1>=a)
    {
        ld x=(2*v1*b1+v1*(b-a)-a1*v2)/(2*v2+v1);
        if(x>=0&&x<=b-a-b1)
        {
            ans=min(ans,(2*x+a1)/v1);
        }
        ans=min(ans,max((2*(b-a-b1)+a1)/v1,3*b1/v2));
        x=(v1*b1+2*(b-a)*v1-v2*a1)/(2*v2+2*v1);
        if(x>=b-a-b1&&x<=b-a)
        {
            ans=min(ans,(2*x+a1)/v1);
        }
    }
    else if(a1*2<=b)
    {
        ld x=(v1*b1+2*v1*(b-a)-a1*v2)/(2*v2+v1);
        if(x>=0&&x<=a1)
        {
            ans=min(ans,(2*x+a1)/v1);
        }
        ans=min(ans,max(3*a1/v1,(2*(b-2*a1)+b1)/v2));
        x=(v1*b1+2*(b-a)*v1-2*v2*a1)/(v2+2*v1);
        if(x>=a1&&x<=b-a)
        {
            ans=min(ans,(2*a1+x)/v1);
        }
    }
    else
    {
        ld x=(v1*b1+2*(b-a)*v1-v2*a1)/(2*v2+2*v1);
        if(x>=0&&x<=b-a)ans=min(ans,(2*x+a1)/v1);
    }
    ans=min(ans,max(b/v2,(n-a)/v1));
    cout<<fixed<<setprecision(6)<<ans<<'\n';
}
int main()
{
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int T=1;
    cin>>T;
    while(T--)
    {
        work();
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3800kb

input:

2
10000.0 1.0 0.001 9999.0 0.001
4306.063 4079.874 0.607 1033.423 0.847

output:

5001000.000000
3827.837001

result:

ok 2 numbers

Test #2:

score: 0
Accepted
time: 1ms
memory: 3860kb

input:

1
10.0 1.0 10.0 9.0 0.1

output:

1.100000

result:

ok found '1.1000000', expected '1.1000000', error '0.0000000'

Test #3:

score: 0
Accepted
time: 0ms
memory: 3676kb

input:

1
10.0 8.0 10.0 9.0 0.1

output:

1.200000

result:

ok found '1.2000000', expected '1.2000000', error '0.0000000'

Test #4:

score: 0
Accepted
time: 0ms
memory: 3804kb

input:

1
10.0 8.0 0.1 9.0 10

output:

1.100000

result:

ok found '1.1000000', expected '1.1000000', error '0.0000000'

Test #5:

score: 0
Accepted
time: 0ms
memory: 3904kb

input:

1
10.0 2.0 0.1 3.0 10

output:

1.300000

result:

ok found '1.3000000', expected '1.3000000', error '0.0000000'

Test #6:

score: 0
Accepted
time: 0ms
memory: 3672kb

input:

1
10.0 9.0 0.1 8.0 10.0

output:

1.200000

result:

ok found '1.2000000', expected '1.2000000', error '0.0000000'

Test #7:

score: 0
Accepted
time: 0ms
memory: 3852kb

input:

1
10.0 4.0 0.1 6.0 0.1

output:

60.000000

result:

ok found '60.0000000', expected '60.0000000', error '0.0000000'

Test #8:

score: 0
Accepted
time: 0ms
memory: 3928kb

input:

1
10.0 4.5 0.1 6.0 0.1

output:

57.500000

result:

ok found '57.5000000', expected '57.5000000', error '0.0000000'

Test #9:

score: 0
Accepted
time: 0ms
memory: 3912kb

input:

1
10.0 1.0 1.0 8.0 1.0

output:

6.500000

result:

ok found '6.5000000', expected '6.5000000', error '0.0000000'

Test #10:

score: 0
Accepted
time: 0ms
memory: 3808kb

input:

1
10.0 3.0 2.0 7.0 1.0

output:

4.600000

result:

ok found '4.6000000', expected '4.6000000', error '0.0000000'

Test #11:

score: 0
Accepted
time: 0ms
memory: 3812kb

input:

1
10.0 6.0 2.0 7.0 1.0

output:

3.666667

result:

ok found '3.6666670', expected '3.6666667', error '0.0000001'

Test #12:

score: 0
Accepted
time: 0ms
memory: 3804kb

input:

1
10.0 1.0 1.0 9.0 1.0

output:

6.000000

result:

ok found '6.0000000', expected '6.0000000', error '0.0000000'

Test #13:

score: 0
Accepted
time: 0ms
memory: 3796kb

input:

1
10000.0 1.0 0.001 1.0 0.001

output:

9999000.000000

result:

ok found '9999000.0000000', expected '9999000.0000000', error '0.0000000'

Test #14:

score: 0
Accepted
time: 0ms
memory: 3804kb

input:

1
10.0 5.0 1.0 5.0 1.5

output:

5.000000

result:

ok found '5.0000000', expected '5.0000000', error '0.0000000'

Test #15:

score: -100
Wrong Answer
time: 11ms
memory: 3872kb

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.837001
7999.364992
12559.335802
15371.550702
2637.698520
9931.041518
934.494301
2939.179625
5754.032890
2847.427157
10975.323628
2180.278607
23747.045455
6278.103555
872.397706
10734.395644
1005.077029
20225.163090
9878.009946
22899.259259
12241.085926
33365.476190
3153.058733
11691.597625
2016...

result:

wrong answer 36th numbers differ - expected: '5767.1781346', found: '6171.6421570', error = '0.0701320'