# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
574116 | imsifile | Computer Network (BOI14_network) | C11 | 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 "network.h"
int dd[1010];
int ping(int, int);
void travelTo(int);
void findRoute(int N, int a, int b)
{
for (int i = 1; i <= N; i++)
dd[i] = i != b ? ping(i, b) : 0;
int pv = a;
for (int i = 1; i <= N; i++)
{
for (int j = 1; j <= N; j++)
{
if (dd[pv] != dd[j] + 1)
continue;
if (ping(pv, j) == 1)
{
travelTo(j);
pv = j;
break;
}
}
if (pv == b)
break;
}
}