# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
151888 | Ruxandra985 | Computer Network (BOI14_network) | C++14 | 113 ms | 4316 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 <cstdio>
#include "network.h"
void findRoute (int n,int a,int b){
int da[n+1],db[n+1];
int i,curr,x,y,nxt;
for (i=1;i<=n;i++){
da[i] = db[i] = -2;
}
curr = a;
x = -1;
da[b] = db[a] = ping(a,b);
y = da[b];
while (curr!=b){
int more = 0;
for (i=1;i<=n;i++){
if (i!=curr){
if (da[i] == -2)
da[i] = ping(a,i);
if (da[i] == x + 1){
if (i == b)
db[i] = -1;
else {
if (db[i] == -2)
db[i] = ping(i,b);
}
if (y-1 == db[i]){
if (!more)
nxt = i;
else {
if (curr == a || ping(curr,nxt)==0)
break;
else nxt = i;
}
more = 1;
}
}
}
}
travelTo(nxt);
curr = nxt;
x++;
y--;
}
}
Compilation message (stderr)
# | 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... |