| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1342673 | weedywelon | 컴퓨터 네트워크 (BOI14_network) | C++20 | 58 ms | 4304 KiB |
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <iostream>
#include <iomanip>
#include <limits.h>
#include <set>
#include <string>
#include <queue>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <deque>
#include <map>
#include <chrono>
#include <random>
#include <bitset>
#include <tuple>
#include "network.h"
#define SZ(x) int(x.size())
#define FR(i,a,b) for(int i=(a);i<(b);++i)
#define FOR(i,n) FR(i,0,n)
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define A first
#define B second
#define mp(a,b) make_pair(a,b)
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
typedef unsigned __int128 U128;
typedef __int128 I128;
typedef std::pair<int,int> PII;
typedef std::pair<LL,LL> PLL;
using namespace std;
//n^2 get all edges
//run bfs
//so u know all the dists from a
//let dist from a to b be d
//categorise by distance to a
//2n: get all nodes that are along a shortest path
//fix the one u want to travel to
//for each x at distance, check whether prev is on a shortest path from a to x
//build the path
//ok maybe we dont need to find out whats on shortest path
//categorise by distance from b? n calls
//start from a
//if traverse an edge, dist-- -> youve moved along a shortest path n calls
//is this tuff
vector<int> d[1003]; //distance from b
void findRoute (int N, int a, int b){
int n=N;
vector<PII> v(n+1);
int dist=ping(a,b);
FR(i,1,n+1){
if (i==a || i==b) continue;
int tmp=ping(i,b)+1;
d[tmp].push_back(i);
}
vector<int> path;
int cur=a;
for (int i=dist-1; i>0; i--){
for (int x:d[i]) if (ping(x,cur)==0){
path.push_back(x);
cur=x;
break;
}
}
path.push_back(b);
for (int u:path) travelTo(u);
return;
}
컴파일 시 표준 에러 (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... | ||||
