# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
24322 | Bruteforceman | Computer Network (BOI14_network) | C++11 | 156 ms | 6188 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;
vector <int> g[2000];
map <pair <int, int>, int> mem;
int dist(int x, int y) {
if(x > y) swap(x, y);
if(x == y) return 0;
if(mem.find(make_pair(x, y)) == mem.end()) return mem[make_pair(x, y)] = ping(x, y) + 1;
else return mem[make_pair(x, y)];
}
void findRoute (int N, int a, int b)
{
for(int i = 1; i <= N; i++) {
g[dist(a, i)].push_back(i);
}
vector <int> rout;
rout.push_back(b);
for(int i = dist(a, b)-1; i >= 1; i--) {
for(auto j : g[i]) {
if(dist(j, rout.back()) == 1) {
rout.push_back(j);
break;
}
}
}
reverse(rout.begin(), rout.end());
for(auto i : rout) {
travelTo(i);
}
}
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... |