| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1310947 | hmms127 | Stations (IOI20_stations) | C++20 | 0 ms | 0 KiB |
//#include "stations.h"
#include <vector>
#include<bits/stdc++.h>
#define pb push_back
using namespace std;
std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
vector<int>labels(n);
for(int i=0;i<n;i++)labels[i]=i;
return labels;
}
int find_next_station(int s, int t, std::vector<int> c) {
auto can=[&](int node,int par){
if(par==node)return 1;
while(par>=node){
par-=1;par/=2;
if(par==node)return 1;
}
return 0;
};
if(s==0){
if(can(c[0],it))return c[0];
return c[1];
}
for(auto it:c){
if(can(it,t))return it;
}
return c[0];
}
