Submission #976325

#TimeUsernameProblemLanguageResultExecution timeMemory
976325kwongwengCyberland (APIO23_cyberland)C++17
0 / 100
154 ms10264 KiB
#include "cyberland.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; typedef pair<int, int> ii; typedef vector<ii> vii; typedef long double ld; typedef vector<vector<ll>> vll; #define FOR(i, a, b) for(int i = a; i < b; i++) #define ROF(i, a, b) for(int i = a; i >= b; i--) #define pb push_back #define ms memset #define fi first #define se second const int mxn = 1e5+1; vector<pair<int,double>> g[mxn]; double solve(int N, int M, int K, int H, vi x, vi y, vi c, vi arr) { FOR(i,0,M){ g[x[i]].pb({y[i],c[i]}); g[y[i]].pb({x[i],c[i]}); } vector<double> dist(N); set<pair<double,int>> st; st.insert({dist[0],0}); FOR(i,1,N){ if (arr[i]==0){ st.insert({dist[i],i}); }else{ dist[i] = 1e18; } } while (!st.empty()){ int u = (*st.begin()).se; st.erase(st.begin()); for (ii edge : g[u]){ int v = edge.fi; int w = edge.se; if (dist[v] > dist[u] + w){ if (dist[v] < 1e18) st.erase({dist[v],v}); dist[v] = dist[u]+w; st.insert({dist[v],v}); } } } if (dist[H]==1e18) return -1; return (double)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...