# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
772592 | khshg | Stations (IOI20_stations) | C++14 | 721 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 >>= 1;
}
S.push_back(0);
while(t > 0) {
T.push_back(t);
t >>= 1;
}
T.push_back(0);
int LCA = -1;
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 LCA / 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... |