QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#697154#8022. WalkerMLKWA 27ms4020kbC++141.6kb2024-11-01 11:25:432024-11-01 11:25:43

Judging History

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

  • [2024-11-01 11:25:43]
  • 评测
  • 测评结果:WA
  • 用时:27ms
  • 内存:4020kb
  • [2024-11-01 11:25:43]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;

double n;
double p1,p2;
double v1,v2;

const double eps = 1e-8;

int main()
{
    int T;
    cin >> T;
    while(T -- ){
        cin >> n >> p1 >> v1 >> p2 >> v2;
        
        if(p1 > p2) swap(p1,p2),swap(v1,v2);
        
        double a1 = (p1 + n) / v1;
        double a2 = (n - p1 + n) / v1;
        double a3 = (p2 + n) / v2;
        double a4 = (n - p2 + n) / v2;
        double a5 = max((n - p2) / v2,min((p1 + p2) / v1,(p2 + p2 - p1) / v1));
        double a6 = max(p1 / v1,min((n + n - p1 - p2) / v2,(p2 - p1 + n - p1) / v2));
        double a7 = (n + n - p2 + p1) / (v1 + v2);
        double t = (p2 - p1) / (v1 + v2),x = v1 * t;
        double a8 = t + max((p1 > eps ? (x+p1)/v1 : 0),(p2 < n - eps ? (n - p1 - x) / v2 : 0));
        x = (p1*v2+p2*v1+n*v1)/(v1*2+v2*2);
        double a9 = (x>=p1&&x<=p2?(x*2-p1)/v1:1e18);
        x = (n*v1*2-p2*v1-p1*v2) / (v1 + v2);
		double a10 = (x>=0&&x<=n?(x + p1) / v1:1e18);
		x = (n*2*v1-p2*v1+p1*v2)/(v2*2+v1);
		double a11 = (x>=p1&&x<=n?(x*2-p1)/v1:1e18);
		x = (n*v1+p2*v1-p1*v2)/(v1*2+v2);
		double a12 = (x>=0&&x<=p2?(x+p1)/v1:1e18);
        
        
        // double a9 = (1?(x*2-p1)/v1:1e18);
        // x = (n*v1*2-p2*v1-p1*v2) / (v1 + v2);
		// double a10 = (1?(x + p1) / v1:1e18);
		// x = (n*2*v1-p2*v1+p1*v2)/(v2*2+v1);
		// double a11 = (1?(x*2-p1)/v1:1e18);
		// x = (n*v1+p2*v1-p1*v2)/(v1*2+v2);
		// double a12 = (1?(x+p1)/v1:1e18);
        
        printf("%.20lf\n",min({a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12}));        
    }

    return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 4020kb

input:

2
10000.0 1.0 0.001 9999.0 0.001
4306.063 4079.874 0.607 1033.423 0.847

output:

5001000.00000000000000000000
3827.83700137551613806863

result:

ok 2 numbers

Test #2:

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

input:

1
10.0 1.0 10.0 9.0 0.1

output:

1.10000000000000008882

result:

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

Test #3:

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

input:

1
10.0 8.0 10.0 9.0 0.1

output:

1.19999999999999995559

result:

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

Test #4:

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

input:

1
10.0 8.0 0.1 9.0 10

output:

1.10000000000000008882

result:

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

Test #5:

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

input:

1
10.0 2.0 0.1 3.0 10

output:

1.30000000000000004441

result:

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

Test #6:

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

input:

1
10.0 9.0 0.1 8.0 10.0

output:

1.19999999999999995559

result:

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

Test #7:

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

input:

1
10.0 4.0 0.1 6.0 0.1

output:

60.00000000000000000000

result:

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

Test #8:

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

input:

1
10.0 4.5 0.1 6.0 0.1

output:

57.49999999999997868372

result:

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

Test #9:

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

input:

1
10.0 1.0 1.0 8.0 1.0

output:

6.50000000000000000000

result:

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

Test #10:

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

input:

1
10.0 3.0 2.0 7.0 1.0

output:

4.59999999999999964473

result:

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

Test #11:

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

input:

1
10.0 6.0 2.0 7.0 1.0

output:

3.66666666666666696273

result:

ok found '3.6666667', expected '3.6666667', error '0.0000000'

Test #12:

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

input:

1
10.0 1.0 1.0 9.0 1.0

output:

6.00000000000000000000

result:

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

Test #13:

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

input:

1
10000.0 1.0 0.001 1.0 0.001

output:

9999000.00000000000000000000

result:

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

Test #14:

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

input:

1
10.0 5.0 1.0 5.0 1.5

output:

5.00000000000000000000

result:

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

Test #15:

score: -100
Wrong Answer
time: 27ms
memory: 4012kb

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.83700137551613806863
7999.36499215070489299251
12559.33580246913697919808
15415.54446177846693899482
2637.69851951547752832994
9931.04151753758014820050
934.49430113977211931342
4326.94906166219880105928
5754.03288987435280432692
2847.42715700141434354009
10975.32362821948481723666
2902.1791044...

result:

wrong answer 4th numbers differ - expected: '15371.5507020', found: '15415.5444618', error = '0.0028620'