Submission #985120

#TimeUsernameProblemLanguageResultExecution timeMemory
985120reverberationCyberland (APIO23_cyberland)C++17
8 / 100
28 ms6744 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; using pll = pair<ll, ll>; double solve(int n, int m, int k, int h, vector<int> x, vector<int> y, vector<int> c, vector<int> v) { vector<vector<pll>> g(n); for (ll i = 0; i < m; i++) { ll a = x[i], b = y[i], cost = c[i]; g[a].push_back({b, cost}); g[b].push_back({a, cost}); } vector<ll> dist(n, 1e16 + 10); dist[0] = 0; priority_queue<pll, vector<pll>, greater<pll>> q; q.push({0, 0}); while (!q.empty()) { auto [curcost, v] = q.top(); q.pop(); if (curcost != dist[v]) continue; for (auto [to, cost] : g[v]) { if (dist[to] > dist[v] + cost) { dist[to] = dist[v] + cost; q.push({dist[to], to}); } } } return dist[h]; }
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...