Submission #378585

#TimeUsernameProblemLanguageResultExecution timeMemory
378585rk42745417Evacuation plan (IZhO18_plan)C++17
0 / 100
131 ms9608 KiB
#include <bits/stdc++.h> using namespace std; using ll = int64_t; using ull = uint64_t; using uint = uint32_t; using ld = long double; const int MOD = 1e9 + 7; const int INF = 0x3f3f3f3f; const ll LINF = 2e18; const double EPS = 1e-9; #define EMT ios::sync_with_stdio(0); cin.tie(0); const int N = 1e5 + 25; int dis[N]; vector<int> npp; vector<pair<int, int>> edge[N]; void solve() { memset(dis, 0x3f, sizeof dis); priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> pq; for(int a : npp) dis[a] = 0, pq.push({dis[a], a}); while(!pq.empty()) { auto [u, c] = pq.top(); pq.pop(); if(c > dis[u]) continue; for(const auto &[v, d] : edge[u]) { if(dis[v] > c + d) { dis[v] = c + d; pq.push({dis[v], v}); } } } } void solve1(int n) { // n <= 15 int q; cin >> q; while(q--) { int s, t; int res = INF; for(int i = 0; i < (1 << n); i++) { } } } void solve2(int n) { // direct road int q; cin >> q; while(q--) { int s, t; cin >> s >> t; cout << min(dis[s], dis[t]) << '\n'; } } signed main() { EMT int n, m; cin >> n >> m; for(int i = 0; i < m; i++) { int u, v, w; cin >> u >> v >> w; edge[u].push_back({v, w}); edge[v].push_back({u, w}); } int k; cin >> k; npp.resize(k); for(int &a : npp) cin >> a; solve(); if(n <= 15) { solve1(n); } else solve2(n); }

Compilation message (stderr)

plan.cpp: In function 'void solve1(int)':
plan.cpp:41:7: warning: unused variable 's' [-Wunused-variable]
   41 |   int s, t;
      |       ^
plan.cpp:41:10: warning: unused variable 't' [-Wunused-variable]
   41 |   int s, t;
      |          ^
plan.cpp:42:7: warning: unused variable 'res' [-Wunused-variable]
   42 |   int res = INF;
      |       ^~~
#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...