Submission #750483

#TimeUsernameProblemLanguageResultExecution timeMemory
750483GurbanCyberland (APIO23_cyberland)C++17
15 / 100
40 ms7588 KiB
#include "cyberland.h" #include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; const ll inf = 1e18; 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]}); } arr[0] = 0; 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; q.pop(); if(arr[x] == 0) return dis[x]; 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 -1; }

Compilation message (stderr)

cyberland.cpp: In function 'double solve(int, int, int, int, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
cyberland.cpp:25:8: warning: unused variable 'ans' [-Wunused-variable]
   25 |     ll ans = inf;
      |        ^~~
#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...