#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 |
1 |
Incorrect |
108 ms |
8992 KB |
Output isn't correct - Too many calls to ping |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
92 ms |
8992 KB |
Output is correct |
2 |
Correct |
28 ms |
8992 KB |
Output is correct |
3 |
Correct |
124 ms |
8992 KB |
Output is correct |
4 |
Correct |
100 ms |
8992 KB |
Output is correct |
5 |
Correct |
124 ms |
8992 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
112 ms |
8992 KB |
Output isn't correct - Too many calls to ping |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
116 ms |
8992 KB |
Output isn't correct - Too many calls to ping |
2 |
Halted |
0 ms |
0 KB |
- |