Submission #917777

#TimeUsernameProblemLanguageResultExecution timeMemory
917777XXBabaProBerkayCyberland (APIO23_cyberland)C++17
0 / 100
28 ms6748 KiB
#include <bits/stdc++.h> using namespace std; #define F first #define S second using ll = long long; ll solve(int N, int M, int K, int H, vector<int> x, vector<int> y, vector<int> c, vector<int> arr) { vector<vector<pair<int, ll>>> adj(N); for (int i = 0; i < M; i++) { adj[x[i]].emplace_back(y[i], c[i]); adj[y[i]].emplace_back(x[i], c[i]); } priority_queue<pair<ll, int>, vector<pair<ll, int>>, greater<pair<ll, int>>> PQ; vector<ll> dist(N, 1e18); dist[0] = 0; PQ.emplace(0, 0); while (!PQ.empty()) { auto [d, u] = PQ.top(); PQ.pop(); if (d != dist[u]) continue; for (pair<int, ll> i : adj[u]) { auto [v, w] = i; if (dist[v] > dist[u] + w) PQ.emplace(dist[v] = dist[u] + w, v); } } 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...