| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1348629 | bananacookie | 컴퓨터 네트워크 (BOI14_network) | C11 | 0 ms | 0 KiB |
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#include "network.h" //**********
const int NN=1005;
vector<int> dist[NN];
void findRoute (int N, int a, int b)
{
int dist_b;
for(int i=1;i<=N;i++){
if(i==a) continue;
int cur_dist=ping(a,i);
dist[cur_dist].push_back(i);
if(i==b) dist_b=cur_dist;
}
vector<int> path; path.push_back(b);
int cur_v=b;
for(int i=dist_b-1;i>=0;i--){ //i=subset of previous node
for(int u:dist[i]){
if(ping(u,cur_v)==0){
path.push_back(u);
cur_v=u;
break;
}
}
}
reverse(path.begin(),path.end());
for(int x:path) travelTo(x);
}
