Submission #307686

#TimeUsernameProblemLanguageResultExecution timeMemory
307686CodePlatinaStations (IOI20_stations)C++14
0 / 100
912 ms1272 KiB
#include "stations.h" #include <vector> using namespace std; vector<int> gph[1010]; int ord[1010]; int cnt = 0; void dfs(int x) { ord[x] = ++cnt; for(auto y : gph[x]) if(!ord[y]) dfs(y); } vector<int> label(int n, int k, vector<int> u, vector<int> v) { vector<int> labels(n); for(int i = 0; i < n; ++i) ord[i] = 0; cnt = 0; for(int i = 0; i < n - 1; ++i) { gph[u[i]].push_back(v[i]); gph[v[i]].push_back(u[i]); } dfs(0); for(int i = 0; i < n; ++i) labels[i] = ord[i]; return labels; } int find_next_station(int s, int t, vector<int> c) { int mn = (int)1e9, mn2 = (int)1e9; for(int x : c) { if(mn2 > x) swap(x, mn2); if(mn > mn2) swap(mn, mn2); } int n = (mn2 == (int)1e9 ? c[0] + 1 : mn2 - 1); if(s <= n && n <= t) { for(int x : c) if(n <= x && x <= t) return x; } else return mn; }

Compilation message (stderr)

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