Submission #971566

#TimeUsernameProblemLanguageResultExecution timeMemory
971566NomioCyberland (APIO23_cyberland)C++17
0 / 100
23 ms6264 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; vector<bool> V(100000, 0); vector<pair<int, int>> v[100000]; vector<int> x, y, c, a; double solve(int n, int m, int k, int h, vector<int> x, vector<int> y, vector<int> c, vector<int> a) { priority_queue<pair<ll, int>, vector<pair<ll, int>>, greater<pair<ll, int>>> pq; vector<ll> dis(n, 1e18); dis[0] = 0; pq.push({0, 0}); while(!pq.empty()) { ll x = pq.top().first; int y = pq.top().second; pq.pop(); if(dis[y] != x) continue; for(pair<int, int> p : v[y]) { int X = p.first; int Y = p.second; if(V[X] && dis[X] != 0) { dis[X] = 0; pq.push({0, X}); } else if(dis[X] > dis[y] + Y) { dis[X] = dis[y] + Y; pq.push({dis[X], X}); } } } if(dis[h] == 1e18) { return -1; } else { return dis[h]; } } //int main() { // ios::sync_with_stdio(0); // cin.tie(0); // int t; // cin >> t; // while(t--) { // int n, m, k, h; // cin >> n >> m >> k >> h; // x.clear(); // y.clear(); // c.clear(); // a.clear(); // for(int i = 0; i < n; i++) { // v[i].clear(); // } // for(int i = 0; i < n; i++) { // int a1; // cin >> a1; // if(a1 == 0) { // V[i] = 1; // } else { // V[i] = 0; // } // a.push_back(a1); // } // while(m--) { // int x1, y1, c1; // cin >> x1 >> y1 >> c1; // v[x1].push_back({y1, c1}); // v[y1].push_back({x1, c1}); // x.push_back(x1); // y.push_back(y1); // c.push_back(c1); // } // cout << solve(n, m, k, h, x, y, c, a) << '\n'; // } // return 0; //}
#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...