#include <bits/stdc++.h>
#include "Encoder.h"
using namespace std;
const int N = 2e5 + 5;
vector<int> a, adj[N];
int in[N], sz[N], idx;
void build() {
double r = pow(2, 20.0 / 256.0);
a.push_back(1);
while(a.size() < 256) {
int x = a.back() * r;
if(x == a.back()) ++x;
a.push_back(x);
}
}
void dfs(int u, int p) {
in[u] = idx++, sz[u] = 1;
for(int v : adj[u]) if(v - p) {
dfs(v, u);
sz[u] += sz[v];
}
int opt = lower_bound(a.begin(), a.end(), sz[u]) - a.begin();
sz[u] = a[opt];
idx = in[u] + sz[u];
Code(u, ((long long)in[u] << 8) | opt);
}
void Encode(int n, int A[], int B[]) {
build();
for(int i = 0; i < n - 1; ++i) {
adj[A[i]].push_back(B[i]);
adj[B[i]].push_back(A[i]);
}
dfs(0, -1);
}
Compilation message
/tmp/ccSHEgTY.o: In function `main':
grader_device.cpp:(.text.startup+0xe3): undefined reference to `InitDevice()'
grader_device.cpp:(.text.startup+0x16a): undefined reference to `Answer(long long, long long)'
collect2: error: ld returned 1 exit status