# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
559442 | Sam_a17 | 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 <bits/stdc++.h>
#include "network.h"
using namespace std;
const int M = 1e3 + 10;
vector<int> adj[M];
void findRoute (int N, int a, int b) {
/*
int dist = ping(a, b);
for (int i = 1; i <= dist; ++i)
travelTo(i);
*/
int maxi = dist(a, b);
for(int i = 1; i <= N; i++) {
if(i == a || i == b) {
continue;
}
int dist = (i, b);
if(dist < maxi) {
adj[dist].push_back(i);
}
}
int curr = a;
for(int i = maxi - 1; i >= 0; i--) {
for(auto j: adj[i]) {
if(!dist(curr, j)) {
travelTo(j);
curr = j;
break;
}
}
}
travelTo(b);
}