QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#606044 | #9293. Fine Trip | lym# | WA | 0ms | 3876kb | C++20 | 1.1kb | 2024-10-02 21:48:43 | 2024-10-02 21:48:43 |
Judging History
answer
#include<bits/stdc++.h>
using i64 = long long;
#define int i64
#define double long double
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: 0
Wrong Answer
time: 0ms
memory: 3876kb
input:
3 3 100 1 3 100 100 1 2 100 24 2 3 100 24
output:
0.0000000000
result:
wrong answer 1st numbers differ - expected: '96.0000000', found: '0.0000000', error = '1.0000000'