# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
752454 | jamielim | Computer Network (BOI14_network) | C++14 | 97 ms | 4488 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 fi first
#define se second
#define mp make_pair
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> ii;
const int INF=1012345678;
map<int,vector<int> > dista;
void findRoute (int N, int a, int b){
int d=ping(a,b)+1;
for(int i=1;i<=N;i++){
if(i==a||i==b)continue;
int x=ping(i,a)+1;
dista[x].pb(i);
}
int ans[d+1];
ans[d]=b;
int cur=b;
for(int i=d-1;i>=1;i--){
for(int j:dista[i]){
int y=ping(j,cur);
if(y==0){
cur=j;
ans[i]=j;
break;
}
}
}
for(int i=1;i<=d;i++)travelTo(ans[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... |