QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#604865#8022. Walkerucup-team3519#WA 1ms3956kbC++171.5kb2024-10-02 14:18:042024-10-02 14:18:06

Judging History

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

  • [2024-10-02 14:18:06]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3956kb
  • [2024-10-02 14:18:04]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef double db;
#define V vector
#define pb push_back
int main() {
    cout << fixed << setprecision(15);
    ios::sync_with_stdio(0), cin.tie(0);
    int t; cin >> t;
    while(t--) {
        db n; cin >> n;

        db a, v1, b, v2; cin >> a >> v1 >> b >> v2;

        if(a > b) swap(a, b), swap(v1, v2);

        db l = a, r = b;
        auto cal = [&](db x) {
            return max(min((a + (x - a) * 2) / v1, ((x - a) * 2 + a) / v1), min(((n - b) + (b - x) * 2) / v2, ((n - b) * 2 + (b - x)) / v2));
        };
        for(int i = 1; i <= 200; i++) {
            db mid1 = l + (r - l) / 3;
            db mid2 = l + (r - l) * 2 / 3;
            if(cal(mid1) > cal(mid2)) l = mid1;
            else r = mid2;
        }

        cout << min({
            (n + (n - b)) / v2, 
            (n + b) / v2, 
            (n + a) / v1, 
            (n + (n - a)) / v1,
            (n + a + (n - b)) / (v1 + v2),
            max(a / v1, (n - a + (n - b)) / v2),
            max((n - b) / v2, (n - (n - b) + a) / v1),
            max((n - a) / v1, (n - (n - b)) / v2),
            max(a / v1, ((b - a) * 2 + (n - b)) / v2),
            max((n - b) / v2, (a + (b - a) * 2) / v1),
            2 * (b - a) / (v1 + v2) + max(a / v1, (n - b) / v2),
            cal(l)
        }) << endl;

        // cout << l << endl;

        // cout << cal(l) << endl;
        // cout << cal(2300) << endl;
    }


}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2
10000.0 1.0 0.001 9999.0 0.001
4306.063 4079.874 0.607 1033.423 0.847

output:

5001000.000000000000000
3827.837001375516138

result:

ok 2 numbers

Test #2:

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

input:

1
10.0 1.0 10.0 9.0 0.1

output:

1.100000000000000

result:

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

Test #3:

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

input:

1
10.0 8.0 10.0 9.0 0.1

output:

1.200000000000000

result:

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

Test #4:

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

input:

1
10.0 8.0 0.1 9.0 10

output:

1.100000000000000

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.300000000000000

result:

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

Test #6:

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

input:

1
10.0 9.0 0.1 8.0 10.0

output:

1.200000000000000

result:

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

Test #7:

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

input:

1
10.0 4.0 0.1 6.0 0.1

output:

60.000000000000000

result:

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

Test #8:

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

input:

1
10.0 4.5 0.1 6.0 0.1

output:

57.500000000000014

result:

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

Test #9:

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

input:

1
10.0 1.0 1.0 8.0 1.0

output:

6.500000000000000

result:

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

Test #10:

score: -100
Wrong Answer
time: 0ms
memory: 3840kb

input:

1
10.0 3.0 2.0 7.0 1.0

output:

4.666666666666668

result:

wrong answer 1st numbers differ - expected: '4.6000000', found: '4.6666667', error = '0.0144928'