# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
445448 | blue | Computer Network (BOI14_network) | C++17 | 107 ms | 7344 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 <vector>
#include <iostream>
using namespace std;
int getDist(int x, int y)
{
if(x == y) return 0;
else
{
int P = ping(x, y);
// cerr << "returning " << P << " for " << x << ", " << y << "\n";
return P + 1;
}
}
void findRoute(int N, int a, int b)
{
int distA[N+1];
for(int i = 1; i <= N; i++) distA[i] = getDist(a, i);
vector<int> dist_list[N+1];
for(int i = 1; i <= N; i++)
{
dist_list[ distA[i] ].push_back(i);
}
for(int x = 1; x <= distA[b]; x++)
{
// cerr << "x = " << x << '\n';
for(int A:dist_list[ distA[a] + 1 ])
{
if(getDist(A, b) == distA[b] - distA[A])
{
// cerr << "travelling to " << A << '\n';
travelTo(A);
a = A;
break;
}
}
}
}
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... |