# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
480476 | dsyz | Computer Network (BOI14_network) | C++17 | 114 ms | 7896 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"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define MAXN (1005)
void findRoute (int N, int a, int b){
int dist = ping(a, b);
ll from[N + 1];
for(int i = 1;i <= N;i++){
if(i != a && i != b){
int fromend = ping(i,b);
from[i] = fromend;
}
}
int cur = a;
int prev = dist;
int visited[N + 1];
memset(visited,0,sizeof(visited));
visited[a] = 1;
visited[b] = 1;
for (int w = 0;w < dist;w++){
for(int i = 1;i <= N;i++){
if(i == a || i == b){
continue;
}
if(visited[i] == 0 && from[i] == prev - 1 && ping(cur,i) == 0){
visited[i] = 1;
prev--;
cur = i;
break;
}
}
travelTo(cur);
}
travelTo(b);
}
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... |