Submission #750473

#TimeUsernameProblemLanguageResultExecution timeMemory
750473GurbanCyberland (APIO23_cyberland)C++17
0 / 100
3072 ms7632 KiB
#include "cyberland.h" #include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; const ll inf = 1e16; const int maxn=1e5+5; // const double eps = 0.00000001; int D[maxn]; vector<pair<int,ll>>E[maxn]; double solve(int N, int M, int K, int H, vector<int> x, vector<int> y, vector<int> c, vector<int> arr) { for(int i = 0;i < N;i++) E[i].clear(); for(int i = 0;i < M;i++){ E[x[i]].push_back({y[i],c[i]}); E[y[i]].push_back({x[i],c[i]}); } ll ans = inf; priority_queue<pair<ll,int>>q; vector<ll>dis(N,inf); vector<bool>vis(N,0); dis[H] = 0; q.push({0,H}); while(!q.empty()){ int x = q.top().second; if(vis[x]) continue; vis[x] = 1; for(auto i : E[x]){ if(dis[i.first] > dis[x] + i.second){ dis[i.first] = dis[x] + i.second; q.push({-dis[i.first],i.first}); } } } ans = dis[0]; for(int i = 0;i < N;i++) if(arr[i] == 0) ans = min(ans,dis[i]); return ans; }
#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...