# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
855849 | Hard_slipper | Computer Network (BOI14_network) | C++14 | 70 ms | 28244 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 "grader.cpp"
#include<bits/stdc++.h>
using namespace std;
vector<int> path[1005][1005] = {};
int vis[1005] = {};
void findRoute (int N, int a, int b)
{
int dist = ping(a, b)+1;
for(int i =1; i <= N; i++)
{
if(i == a || i == b) continue;
int cur_dist = ping(a, i)+1;
int final_dist = ping(i, b)+1;
//cout << cur_dist << ' ' << final_dist << '\n';
if(cur_dist+final_dist == dist)
{
path[cur_dist][final_dist].push_back(i);
}
}
path[dist][0].push_back(b);
int cur_dist = 1;
int final_dist = dist-1;
while(cur_dist <= dist)
{
for(int i = 0; i < path[cur_dist][final_dist].size(); i++)
{
int cur_node = path[cur_dist][final_dist][i];
if(cur_node == b)
{
travelTo(cur_node);
break;
}
//cout << cur_node << ' ';
int dem_dist = ping(cur_node, b)+1;
if(dem_dist == final_dist)
{
//cout << cur_node << '\n';
travelTo(cur_node);
break;
}
}
final_dist--;
cur_dist++;
}
}
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... |