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 N, D[1001][1001], Check[1001], Path[1001], Cnt;
void findPath(int left, int right)
{
int i;
if(D[left][right]==0)
return;
for(i=1 ; i<=N ; i++)
if(Check[i]==0)
{
if(D[left][i]==-1)
D[left][i]=ping(left,i);
if(D[i][right]==-1)
D[i][right]=ping(i,right);
if(D[left][right]==D[left][i]+D[i][right]+1)
{
Check[i]=1;
findPath(left,i);
Path[++Cnt]=i;
findPath(i,right);
break;
}
}
}
void findRoute (int n, int a, int b)
{
int i, j;
N=n;
for(i=1 ; i<=N ; i++)
for(j=1 ; j<=N ; j++)
D[i][j]=-1;
Check[a]=Check[b]=1;
D[a][b]=ping(a,b);
findPath(a,b);
Path[++Cnt]=b;
for(i=1 ; i<=Cnt ; i++)
travelTo(Path[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... |