# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
383193 | 2021-03-29T07:30:47 Z | danielcm585 | Stations (IOI20_stations) | C++14 | 0 ms | 0 KB |
#include "stations.h" #include <bits/stdc++.h> using namespace std; int find_next_station(int S, int T, vector<int> C) { if (C.size() == 1) return C[0]; if (S < C[0]) { for (int i = 0; i < C.size(); i++) { if (S <= T && T <= C[i]) return C[i]; } return C.back(); } else { for (int i = C.size()-1; i >= 0; i--) { if (C[i] <= T && T <= S) return C[i]; } return C[0]; } }