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<bits/stdc++.h>
using namespace std;
vector<int>Vis, new_;
vector<vector<int>>A;
int time_;
void dfs(int ind){
Vis[ind]=1, new_[ind]=time_++;
for(int i=0;i<A[ind].size();i++)
if(!Vis[A[ind][i]])
dfs(A[ind][i]);
}
vector<int> label(int n, int k, vector<int> u, vector<int> v) {
Vis.clear(), A.clear(), new_.clear();
Vis.resize(n), A.resize(n), new_.resize(n);
time_=0;
for(int i=0;i<n-1;i++){
new_[i+1]=u[i], new_[i/2]=v[i];
}
return new_;
}
int find_next_station(int s, int t, vector<int> c) {
bool found=0;
int last=t;
while(t){
t=(t-1)/2;
if(t==s){
found=1;
break;
}
last=t;
}
if(!found)
last=c[0];
return last;
}
Compilation message (stderr)
stations.cpp: In function 'void dfs(int)':
stations.cpp:8:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
8 | for(int i=0;i<A[ind].size();i++)
| ~^~~~~~~~~~~~~~
# | 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... |