Submission #706506

#TimeUsernameProblemLanguageResultExecution timeMemory
706506rafatoaStations (IOI20_stations)C++17
0 / 100
901 ms760 KiB
#include <bits/stdc++.h> using namespace std; vector<int> label(int n, int k, vector<int> u, vector<int> v){ vector<int> l(n); vector<vector<int>> adj(n); for(int i=0; i<n-1; i++){ adj[u[i]].push_back(v[i]); adj[v[i]].push_back(u[i]); } int aux = 0; function<void(int, int)> dfs = [&](int s, int e){ l[s] = aux++; for(auto u:adj[s]) if(u != e) dfs(u, s); }; dfs(0, -1); return l; } int find_next_station(int s, int t, vector<int> c){ if(t < s){ for(auto &x:c) if(x < s) return x; } else { int bst = 0; for(auto &x:c) if(x <= t) bst = max(bst, x); return bst; } }

Compilation message (stderr)

stations.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
stations.cpp:32:1: warning: control reaches end of non-void function [-Wreturn-type]
   32 | }
      | ^
#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...