QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#606035 | #9293. Fine Trip | lym# | WA | 0ms | 4060kb | C++20 | 1.1kb | 2024-10-02 21:46:49 | 2024-10-02 21:46:50 |
Judging History
answer
#include<bits/stdc++.h>
using i64 = long long;
#define int i64
const double inf = 1e18;
using pii = std::pair<int, double>;
using ipp = std::pair<double, int>;
void solve() {
int n, m, t;
std::cin >> n >> m >> t;
std::vector<std::vector<std::pair<int, double> > > e(n + 1);
for (int i = 1; i <= m; i ++) {
int u, v, a, b;
std::cin >> u >> v >> a >> b;
e[u].push_back({v, (double)std::sqrt((double)a * b)});
}
std::vector<double> d(n + 1, inf);
std::vector<bool> vis(n + 1);
d[1] = 0;
std::priority_queue<ipp, std::vector<ipp>, std::greater<ipp> > q;
q.push({0.0, 1});
while (! q.empty()) {
auto it = q.top();
q.pop();
int u = it.second;
if (vis[u]) continue;
vis[u] = 1;
for (auto it : e[u]) {
int v = it.first;
double w = it.second;
if (d[v] > d[u] + w) {
d[v] = d[u] + w;
q.push({d[v], v});
}
}
}
double ans = d[n] * d[n];
printf("%.10lf\n", ans / t);
}
signed main() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int t = 1;
//std::cin >> t;
while (t --) {
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 4060kb
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: 3996kb
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: 0ms
memory: 3900kb
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: 0ms
memory: 3868kb
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:
19221820843.3479995728
result:
wrong answer 1st numbers differ - expected: '1150229105.4195333', found: '19221820843.3479996', error = '15.7112976'