Submission #969757

#TimeUsernameProblemLanguageResultExecution timeMemory
969757zh_hCyberland (APIO23_cyberland)C++17
0 / 100
20 ms6284 KiB
#include <bits/stdc++.h> #define pb push_back using namespace std; const int n = 1e5+5; vector<vector<pair<int, int>>> adj(n); vector<bool> visited(n, false); double dfs(int x, int h, int s){ if(x == h){return s;} for(auto i : adj[x]){ if(!visited[i.first]){ visited[i.first] = true; return dfs(i.first, h, s+i.second); } } } double solve(int N, int M, int K, int H, vector<int> x, vector<int> y, vector<int> c, vector<int> arr){ visited.clear(); visited.resize(n, false); adj.clear(); visited[0] = true; for(int i =0; i < M; i ++){ adj[x[i]].pb({y[i], c[i]}); adj[y[i]].pb({x[i], c[i]}); } return dfs(0, H, 0); }

Compilation message (stderr)

cyberland.cpp: In function 'double dfs(int, int, int)':
cyberland.cpp:18:1: warning: control reaches end of non-void function [-Wreturn-type]
   18 | }
      | ^
#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...