#include "Device.h"
#include<bits/stdc++.h>
using namespace std;
void InitDevice()
{
}
int Answer(long long S, long long T)
{
long long st_x = S / 19;
long long ed_x = st_x + (1 << (S % 19));
long long st_y = T / 19;
long long ed_y = st_y + (1 << (T % 19));
// cout << st_x << " " << ed_x << endl;
// cout << st_y << " " << ed_y << endl;
if (st_x <= st_y && st_y <= ed_x) return 1;
if (st_y <= st_x && st_x <= ed_y) return 0;
return 2;
}
#include "Encoder.h"
#include <bits/stdc++.h>
#include <bits/stdc++.h>
using namespace std;
namespace {
const int NN = 1e5 + 10;
vector<int> adj[NN];
bool vis[NN];
int cnt = -1;
}
void dfs(int u, int p) {
vis[u] = 1;
int st = ++cnt;
for(int &v : adj[u]) if (v != p) dfs(v, u);
int diff = 1, deg = 0;
while (diff < cnt - st) diff *= 2, deg++;
cnt = st + diff;
long long code = st * 19 + deg;
// cout << st << " " << cnt << " " << deg << " " << u << endl;
Code(u, code);
}
void Encode(int N, int A[], int B[])
{
for(int i = 0; i < N - 1; i++) {
adj[A[i]].push_back(B[i]);
adj[B[i]].push_back(A[i]);
}
for(int i = 0; i < N; i++) if (!vis[i]) dfs(i, i);
}
Compilation message
/usr/bin/ld: /tmp/ccuFx62Y.o: in function `main':
grader_encoder.cpp:(.text.startup+0xd1): undefined reference to `Encode(int, int*, int*)'
collect2: error: ld returned 1 exit status
/usr/bin/ld: /tmp/ccHnQoeJ.o: in function `main':
grader_device.cpp:(.text.startup+0xf8): undefined reference to `InitDevice()'
/usr/bin/ld: grader_device.cpp:(.text.startup+0x19b): undefined reference to `Answer(long long, long long)'
collect2: error: ld returned 1 exit status