# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
206682 | 2020-03-04T12:54:34 Z | PeppaPig | 컴퓨터 네트워크 (BOI14_network) | C++14 | 147 ms | 4704 KB |
#include "network.h" #include <bits/stdc++.h> #define pii pair<int, int> #define x first #define y second using namespace std; const int N = 1e3+5; map<pii, int> mp; int get_dist(int a, int b) { if(a == b) return 0; else if(mp.count(pii(a, b))) return mp[pii(a, b)]; else return mp[pii(a, b)] = mp[pii(b, a)] = ping(a, b) + 1; } int len; vector<int> dist[N]; void findRoute (int n, int a, int b) { for(int i = 1; i <= n; i++) if(i != a) { int now = get_dist(a, i); dist[now].emplace_back(i); if(i == b) len = now; } vector<int> ans = { b }; for(int i = len-1; i; i--) for(int x : dist[i]) if(get_dist(ans.back(), x) == 1) { ans.emplace_back(x); break; } reverse(ans.begin(), ans.end()); for(int x : ans) travelTo(x); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 140 ms | 4600 KB | Output is correct |
2 | Correct | 131 ms | 4472 KB | Output is correct |
3 | Correct | 127 ms | 4472 KB | Output is correct |
4 | Correct | 127 ms | 4644 KB | Output is correct |
5 | Correct | 121 ms | 4472 KB | Output is correct |
6 | Correct | 123 ms | 4472 KB | Output is correct |
7 | Correct | 5 ms | 376 KB | Output is correct |
8 | Correct | 5 ms | 376 KB | Output is correct |
9 | Correct | 5 ms | 376 KB | Output is correct |
10 | Correct | 5 ms | 504 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 128 ms | 4472 KB | Output is correct |
2 | Correct | 35 ms | 2424 KB | Output is correct |
3 | Correct | 137 ms | 4472 KB | Output is correct |
4 | Correct | 112 ms | 4472 KB | Output is correct |
5 | Correct | 147 ms | 4704 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 122 ms | 4472 KB | Output is correct |
2 | Correct | 35 ms | 2428 KB | Output is correct |
3 | Correct | 140 ms | 4472 KB | Output is correct |
4 | Correct | 119 ms | 4600 KB | Output is correct |
5 | Correct | 138 ms | 4604 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 126 ms | 4472 KB | Output is correct |
2 | Correct | 35 ms | 2424 KB | Output is correct |
3 | Correct | 136 ms | 4472 KB | Output is correct |
4 | Correct | 112 ms | 4472 KB | Output is correct |
5 | Correct | 137 ms | 4472 KB | Output is correct |