Submission #880320

#TimeUsernameProblemLanguageResultExecution timeMemory
880320MardonbekhazratovCyberland (APIO23_cyberland)C++17
8 / 100
22 ms6412 KiB
#include "cyberland.h" #include<bits/stdc++.h> #include <vector> using namespace std; double solve(int N, int M, int K, int H, vector<int> x, vector<int> y, vector<int> c, vector<int> arr) { vector<vector<pair<int,int>>>v(N); for(int i=0;i<N-1;i++){ v[x[i]].push_back({y[i],c[i]}); v[y[i]].push_back({x[i],c[i]}); } vector<bool>vis(N,0); queue<pair<int,double>>q; q.push({0,0.0}); while(!q.empty()){ pair<int,double>p=q.front(); q.pop(); vis[p.first]=true; if(p.first==H){ return p.second; } for(auto [z,y]:v[p.first]){ if(!vis[z]) q.push({z,p.second+y}); } } }

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:7:37: warning: control reaches end of non-void function [-Wreturn-type]
    7 |     vector<vector<pair<int,int>>>v(N);
      |                                     ^
#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...