# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
24101 | jiaqiyang | City (JOI17_city) | C++14 | 549 ms | 57928 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "Encoder.h"
#include <vector>
#include <algorithm>
static const int N = 250000 + 10;
typedef long long i64;
static std::vector<int> adj[N], r;
static void init() {
int i = 1;
for (; i < N; i += std::max<int>(1, .05 * i)) r.push_back(i);
for (int j = 20; j--; i += std::max<int>(1, .05 * i)) r.push_back(i);
}
static int left[N], right[N], tot;
static void dfs(int a, int fa = -1) {
left[a] = tot++;
for (int i = 0; i < adj[a].size(); ++i) if (adj[a][i] != fa) dfs(adj[a][i], a);
right[a] = tot = left[a] + *std::lower_bound(r.begin(), r.end(), tot - left[a]);
}
void Encode(int n, int a[], int b[]) {
init();
for (int i = 0; i < n - 1; ++i) adj[a[i]].push_back(b[i]), adj[b[i]].push_back(a[i]);
dfs(0);
for (int i = 0; i < n; ++i) {
int x = left[i], y = std::lower_bound(r.begin(), r.end(), right[i] - left[i]) - r.begin();
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |