# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
772610 | khshg | Stations (IOI20_stations) | C++14 | 845 ms | 508 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include"stations.h"
#include<bits/stdc++.h>
using namespace std;
vector<vector<int>> adj;
vector<int> label(int N, int K, vector<int> u, vector<int> v) {
vector<int> labels(N); iota(begin(labels), end(labels), 0);
return labels;
}
int find_next_station(int s, int t, vector<int> c) {
vector<int> S, T;
int start = s, target = t;
while(s > 0) {
S.push_back(s);
s = (s - 1) / 2;
}
while(t > 0) {
T.push_back(t);
t = (t - 1) / 2;
}
int LCA = 0;
while((int)S.size() && (int)T.size() && S.back() == T.back()) {
LCA = S.back();
S.pop_back();
T.pop_back();
}
if(LCA == start) {
return T.back();
}
return (start - 1) / 2;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |