# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
741685 | TheOpChicken | Computer Network (BOI14_network) | C++17 | 108 ms | 7884 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 <iostream>
#include <vector>
#include "network.h"
using namespace std;
void findRoute(int n, int a, int b){
vector<vector<int> > dist(n+5, vector<int>());
vector<int> length(n+5);
dist[0].push_back(a);
for (int i = 1; i <= n; i++){
if (i == a) continue;
int len = ping(a, i);
dist[len].push_back(a);
length[i] = len;
}
int cur_node = b;
vector<int> ans;
for (int i = length[b]; i >= 1; i--){
ans.push_back(cur_node);
for (int node: dist[i-1]){
int len = ping(cur_node, node);
if (len == 1){
cur_node = node;
break;
}
}
}
for (int i = ans.size()-1; i >= 0; i--) travelTo(ans[i]);
return;
}
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... |