Submission #90363

#TimeUsernameProblemLanguageResultExecution timeMemory
90363adletEvacuation plan (IZhO18_plan)C++17
0 / 100
366 ms13900 KiB
#pragma GCC optimize("Ofast") #include <bits/stdc++.h> #define file(s) if (fopen(s".in", "r")) freopen(s".in", "r", stdin), freopen(s".out", "w", stdout) using namespace std; typedef long long ll; const int N = 2e5 + 5; const int mod = 1e9 + 7; const int INF = 1e9; const double PI = acos(-1.0); int n, m, k, q, p[N], u[N], v[N]; ll d[N]; vector < pair < int, int > > g[N]; int get(int v) { return (v == p[v] ? v : p[v] = get(p[v])); } int unite(int v, int u) { } int main() { cin >> n >> m; for (int i = 1; i <= n; ++i) { d[i] = INF; } for (int i = 1; i <= m; ++i) { int w; cin >> u[i] >> v[i] >> w; g[v[i]].push_back({u[i], w}); g[u[i]].push_back({v[i], w}); } cin >> k; set < pair < int, int > > st; for (int i = 1, x; i <= k; ++i) { cin >> x; d[x] = 0; st.insert({0, x}); } while (!st.empty()) { int x = st.begin() -> second; st.erase(st.begin()); for (auto node : g[x]) { int to = node.second, len = node.first; if (d[to] > d[x] + len) { st.erase({d[to], to}); d[to] = d[x] + len; st.insert({d[to], to}); } } } cin >> q; for (int i = 1; i <= q; ++i) { int s, t; cin >> s >> t; cout << min(d[s], d[t]); } }

Compilation message (stderr)

plan.cpp: In function 'int unite(int, int)':
plan.cpp:26:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...