# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
696731 | garam1732 | Stations (IOI20_stations) | C++14 | 942 ms | 544 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<int> adj[1010];
std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
std::vector<int> labels(n);
for(int i = 0; i < n; i++) adj[i].clear();
for(int i = 0; i < u.size(); i++) {
adj[u[i]].push_back(v[i]);
adj[v[i]].push_back(u[i]);
}
for(int i = 0; i < n; i++) labels[i] = i;
return labels;
}
int lca(int s, int t) {
vector<bool> chk(1010);
for(int here = s; here; here >>= 1) chk[here] = 1;
for(int here = t; here; here >>= 1) {
if(chk[here]) return here;
}
}
int find_next_station(int s, int t, std::vector<int> c) {
s++; t++;
int a = lca(s, t);
if(a != s) return s/2-1;
while(t/2 != s) t >>= 1;
return t-1;
}
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... |