Submission #432388

#TimeUsernameProblemLanguageResultExecution timeMemory
432388milleniumEeeeStations (IOI20_stations)C++17
0 / 100
810 ms668 KiB
#ifndef EVAL #include "stub.cpp" #endif #include "stations.h" #include <bits/stdc++.h> #define fr first #define sc second #define pii pair<int, int> #define pb push_back #define szof(s) (int)s.size() #define all(s) s.begin(), s.end() using namespace std; const int MAXN = 1005; vector <int> G[MAXN]; // binary tree vector <int> g[MAXN]; // cur component void clean() { for (int i = 0; i < MAXN; i++) { g[i].clear(); } } bool was_build = false; int tin[MAXN], tout[MAXN], tiktak = 0; int pr[MAXN]; void precalc(int v, int par) { pr[v] = par; tin[v] = ++tiktak; for (int to : G[v]) { if (to != par) { precalc(to, v); } } tout[v] = tiktak; } bool father(int a, int b) { return tin[a] <= tin[b] && tout[b] <= tout[a]; } void build() { for (int i = 0; i < 1000; i++) { G[i + 1].pb(i / 2); G[i / 2].pb(i + 1); } precalc(0, -1); } vector<int> label(int n, int k, vector<int> u, vector<int> v) { if (!was_build) { build(); was_build = 1; } vector <int> labels(n); for (int i = 0; i < n; i++) { labels[i] = i; } return labels; } int find_next_station(int s, int t, vector<int> c) { // check s father t if (father(s, t)) { for (int el : c) { if (father(el, t)) { return el; } } } else { return (s - 1) / 2; } }

Compilation message (stderr)

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