#include "network.h"
#include <vector>
using namespace std;
vector<int> p[1001];
int st[1001];
void findRoute (int N, int a, int b)
{
int dist = ping(a,b) + 1;
for (int i=1;i<=N;i++) if (i != a){
st[i] = ping(a,i) + 1;
p[st[i]].push_back(i);
}
for (int d=1;d<=dist;d++){
bool ed = 0;
for (int i=1;i<p[d].size();i++){
if (ping(a,p[d][i]) == 0){
if (d + ping(a,p[d][i]) + 1 == dist){
travelTo(p[d][i]);
ed = 1;
break;
}
}
}
if (!ed) travelTo(p[d][0]);
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
113 ms |
5220 KB |
Output is correct |
2 |
Incorrect |
152 ms |
5220 KB |
Output isn't correct - Travelling to nonadjacent computer |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
75 ms |
5220 KB |
Output isn't correct - Travelling to nonadjacent computer |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
99 ms |
5220 KB |
Output isn't correct - Travelling to nonadjacent computer |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
130 ms |
5220 KB |
Output isn't correct - Travelling to nonadjacent computer |
2 |
Halted |
0 ms |
0 KB |
- |