Submission #959029

#TimeUsernameProblemLanguageResultExecution timeMemory
959029The_SamuraiStations (IOI20_stations)C++17
0 / 100
561 ms868 KiB
#include "stations.h" #include "bits/stdc++.h" using namespace std; std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) { vector<vector<int>> adj(n); vector<int> tin(n); vector<bool> vis(n + 1); for (int i = 0; i < n - 1; i++) { adj[u[i]].emplace_back(v[i]); adj[v[i]].emplace_back(u[i]); } int z = 0; auto dfs = [&](auto &dfs, int u) -> void { tin[u] = z++; vis[u] = true; for (int v: adj[u]) { if (vis[v]) continue; dfs(dfs, v); } }; dfs(dfs, 1); return tin; } int find_next_station(int s, int t, std::vector<int> c) { sort(c.begin(), c.end()); if (s > t) return c[0]; for (int i = c.size() - 1; i >= 0; i--) { if (c[i] <= t) return c[i]; } }

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...