# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
16055 | tonyjjw | Computer Network (BOI14_network) | C++14 | 0 ms | 0 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<vector>
#define MN 1000
using namespace std;
vector<int> A[MN+1];
int d[MN+1];
void findRoute(int N,int a,int b){
for(int i=1;i<=N;i++){
d[i]=ping(i,b)+1;
if(i==b)d[i]=0;
A[d[i]].push_back(i);
}
while(a!=b){
for(auto n:A[d[a]-1]){
if(ping(a,n)==0){
travelTo(n);
a=n;
break;
}
}
}
}