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 "network.h"
#include<vector>
using namespace std;
const int MX = 1005;
vector<int> G[MX];
void findRoute (int N, int a, int b)
{
int D = ping(a, b) + 1;
for (int i = 1; i <= N; i++){
if (i == b) G[0].push_back(b);
else if( i != a ) G[ping(b, i) + 1].push_back(i);
else G[D].push_back(i);
}
int nw = a;
for (int i = 1;; i++){
int nxt = -1;
for (int j = 0; j < G[D - i].size(); j++){
int c = G[D - i][j];
if (ping(nw, c) == 0){
nxt = c;
if (nxt == b){
travelTo(nxt);
return;
}
}
}
nw = nxt;
travelTo(nxt);
}
}
# | 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... |