Submission #976625

#TimeUsernameProblemLanguageResultExecution timeMemory
976625rakhim_ovaCyberland (APIO23_cyberland)C++17
15 / 100
27 ms6744 KiB
#include "cyberland.h" #include <bits/stdc++.h> using namespace std; using ll = long long; ll INF=1e13; double solve(int N, int M, int K, int H, std::vector<int> x, std::vector<int> y, std::vector<int> c, std::vector<int> arr) { int n=N, m=M, k=K, h=H; double res=-1; vector<vector<pair<int, double>>> adj(n); for(int i=0; i<m; i++){ adj[x[i]].push_back({y[i], c[i]}); adj[y[i]].push_back({x[i], c[i]}); } vector<double> d(n, INF); vector<bool> ch(n, false); priority_queue<pair<double, int>> pq; d[0]=0; pq.push({0, 0}); while(!pq.empty()){ int t=pq.top().second; pq.pop(); if(ch[t]) continue; ch[t]=true; for(auto x: adj[t]){ if(d[t]+x.second<d[x.first]){ // cout << t << ' ' << x.first << ' ' << d[t]+x.second << '\n'; pq.push({-(d[t]+x.second), x.first}); d[x.first]=d[t]+x.second; } } } if(d[h]==INF){ return -1; } // for(auto x: d) cout << x << ' '; // cout << '\n'; return d[h]; }

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:11:19: warning: unused variable 'k' [-Wunused-variable]
   11 |     int n=N, m=M, k=K, h=H;
      |                   ^
cyberland.cpp:12:12: warning: unused variable 'res' [-Wunused-variable]
   12 |     double res=-1;
      |            ^~~
#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...