QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#649303#9293. Fine TriphhoppitreeWA 1ms6356kbC++17916b2024-10-17 22:37:182024-10-17 22:37:22

Judging History

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

  • [2024-10-17 22:37:22]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:6356kb
  • [2024-10-17 22:37:18]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

const int N = 2005;

vector< pair<int, long long> > G[N];
long double f[N][N];

signed main() {
    int n, m, T; scanf("%d%d%d", &n, &m, &T);
    for (int i = 1, x, y, z, v; i <= m; ++i) {
        scanf("%d%d%d%d", &x, &y, &z, &v);
        G[x].push_back({y, 1ll * z * v});
        G[y].push_back({x, 1ll * z * v});
    }
    for (int i = 1; i <= n; ++i) {
        for (int j = 0; j <= n; ++j) f[i][j] = 1e18;
    }
    f[1][0] = 0;
    for (int i = 0; i < n; ++i) {
        for (int j = 1; j <= n; ++j) {
            for (auto [x, y] : G[j]) {
                f[x][i + 1] = min(f[x][i + 1], f[j][i] + sqrt(y));
            }
        }
    }
    long double res = 1e18;
    for (int i = 0; i <= n; ++i) {
        if (f[n][i] < 1e17) res = min(res, (long double)f[n][i] * f[n][i]);
    }
    printf("%.10Lf\n", res / T);
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3 3 100
1 3 100 100
1 2 100 24
2 3 100 24

output:

96.0000000000

result:

ok found '96.0000000', expected '96.0000000', error '0.0000000'

Test #2:

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

input:

3 2 10
1 2 9 1
2 3 1 1000

output:

119.8736659610

result:

ok found '119.8736660', expected '119.8736660', error '0.0000000'

Test #3:

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

input:

4 5 9
1 2 6 7
1 3 6 2
2 3 8 7
2 4 3 4
3 4 1 7

output:

4.1478114200

result:

ok found '4.1478114', expected '4.1478114', error '0.0000000'

Test #4:

score: -100
Wrong Answer
time: 1ms
memory: 6356kb

input:

100 150 986428838
91 64 507238859 759737815
75 4 403581576 658994630
57 21 725237383 935111999
40 87 981276800 673193011
11 43 80691506 709831037
41 89 50163377 373453345
58 36 274674403 292610326
68 54 831628941 850969830
72 28 678792191 467183610
32 92 372884862 179215422
18 6 667244829 651862998
...

output:

1013757872.3139479018

result:

wrong answer 1st numbers differ - expected: '1150229105.4195333', found: '1013757872.3139479', error = '0.1186470'