Submission #976606

#TimeUsernameProblemLanguageResultExecution timeMemory
976606NexusCyberland (APIO23_cyberland)C++17
0 / 100
28 ms15452 KiB
#define ll long long #include <bits/stdc++.h> #include "cyberland.h" using namespace std; const ll N=1e5+9; ll vis[N]; pair<ll,ll>p; double ans=-1; vector<pair<ll,ll>>v[N]; priority_queue<pair<ll,ll>>q; double solve(int n, int M, int K, int H, vector<int> x, vector<int> y, vector<int> c, vector<int> arr) { vector<ll>dis(n,1e18); for(ll i=0;i<M;++i) { v[x[i]].push_back({c[i],y[i]}); v[y[i]].push_back({c[i],x[i]}); } dis[0]=0; q.push({0,0}); while(q.size()) { p=q.top(); q.pop(); if(vis[p.second])continue; vis[p.second]=1; for(auto i:v[p.second]) { if(dis[p.second]+i.second<dis[i.first]) { dis[i.first]=dis[p.second]+i.second; q.push({-dis[i.first],i.first}); } } } if(dis[H]<1e18)ans=dis[H]; 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...