# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
54266 | 2018-07-03T01:16:22 Z | Crown | Commuter Pass (JOI18_commuter_pass) | C++14 | 49 ms | 2192 KB |
#include <bits/stdc++.h> using namespace std; #define X first #define Y second #define pb push_back typedef pair<int, int> ii; typedef long long ll; const int maxn = 305; ll dist[maxn][maxn]; int s, t, u, v; int main() { int n, m; scanf("%d %d", &n, &m); scanf("%d %d %d %d", &s, &t, &u, &v); for(int i = 1; i<= n; i++) for(int j = 1; j<= n; j++) dist[i][j] = 1e18; while(m--) { int u, v; scanf("%d %d", &u, &v); int w; scanf("%d", &w); dist[u][v] = dist[v][u] = w; } for(int k = 1; k<= n; k++) for(int i = 1; i<= n; i++) for(int j = 1; j<= n; j++) dist[i][j] = min(dist[i][j], dist[i][k]+dist[k][j]); ll best = dist[u][v]; for(int u1 = 1; u1<= n; u1++) for(int u2 = 1; u2<= n; u2++) { if(dist[s][u1]+dist[u1][u2]+dist[u2][t] == dist[s][t]) { // printf("%d %d\n", u1, u2); best = min(best, dist[u][u1]+dist[u2][v]); best = min(best, dist[u][u2]+dist[u1][v]); } } printf("%lld\n", best); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 5 ms | 1912 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 3 ms | 1964 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 49 ms | 2192 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 5 ms | 1912 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |