# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
852902 | 2023-09-23T05:55:26 Z | Anonymous_Guys | Commuter Pass (JOI18_commuter_pass) | C++17 | 101 ms | 16068 KB |
#include <bits/stdc++.h> using namespace std; #define pb push_back #define ii pair<int, int> #define ll long long #define int long long #define fi first #define se second #define fou(i, a, b) for (int i = a; i <= b; ++i) #define all(v) (v).begin(), (v).end() #define el '\n' #define MASK(x) (1LL << (x)) #define BIT(mask, x) (((mask) >> (i)) & 1) const int mxN = 1e5 + 9; const int MOD =(int)1e9 + 7; const int INF =(int)1e9; int d[mxN]; vector<ii> adj[mxN]; void dijsktra(int s) { memset(d, 0x3f, sizeof d); d[s] = 0; priority_queue<ii, vector<ii>, greater<ii> > q; q.push({0, s}); while(!q.empty()) { int u = q.top().se; int kc = q.top().fi; q.pop(); if (d[u] != kc) continue; for (auto it : adj[u]) { int v = it.fi; int w = it.se; if (d[v] > d[u] + w) { d[v] = d[u] + w; q.push({d[v], v}); } } } } signed main() { if (fopen("GIAOPIZZA.INP", "r")) { freopen("GIAOPIZZA.INP", "r", stdin); freopen("GIAOPIZZA.OUT", "w", stdout); } ios_base::sync_with_stdio(false); cin.tie(0); int n,m ; cin >> n >> m; int tram_S, tram_T; cin >> tram_S >> tram_T; int tram_U, tram_V; cin >> tram_U >> tram_V; fou(i, 1, m) { int u, v, w; cin >> u >> v >> w; adj[u].pb({v, w}); adj[v].pb({u, w}); } dijsktra(tram_U); cout << d[tram_V]; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 101 ms | 16068 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 98 ms | 15072 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 6 ms | 4952 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 101 ms | 16068 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |