#include "Anthony.h"
#include <bits/stdc++.h>
#define vi vector<int>
#define trav(x, a) for (const auto& x: a)
#define sz(x) (int)(x).size()
#define pb push_back
using namespace std;
namespace {
const int N = 2e4 + 5;
vi adj[N];
int dp[N];
string bl = "001011";
}
vi Mark(int N, int M, int A, int B, vi U, vi V) {
for (int i = 0; i < M; i++)
adj[U[i]].pb(i), adj[V[i]].pb(i);
vi X(M);
if (A > 2) {
deque<int> pq;
pq.pb(0);
fill(dp, dp+N, N+1);
dp[0] = 0;
for (int i = 0; i < M; i++)
X[i] = 2;
while (!pq.empty()) {
int u = pq.front(); pq.pop_front();
trav(x, adj[u]) {
int v = U[x]^V[x]^u;
if (dp[v] > dp[u] + 1) {
dp[v] = dp[u] + 1;
pq.pb(v);
}
if (dp[v] == dp[u] + 1 || dp[v] == dp[u]) {
X[x] = dp[u]%3;
}
}
}
return X;
}
function<void(int,int,int,int)> dfs = [&](int u, int p, int d, int l) {
int f = (u != 0 && sz(adj[u]) > 2 ? 1 : 0);
if (f) d = l ? 2 : 0;
trav(x, adj[u]) {
int v = U[x]^V[x]^u;
if (v != p) {
X[x] = bl[d%sz(bl)]-'0';
dfs(v, u, d+1, X[x]^1);
}
}
};
dfs(0, -1, 0, 0);
return X;
}
#include "Anthony.h"
#include <bits/stdc++.h>
#define vi vector<int>
#define trav(x, a) for (const auto& x: a)
#define sz(x) (int)(x).size()
#define pb push_back
using namespace std;
namespace {
const int N = 2e4 + 5;
vi adj[N];
int dp[N];
string bl = "001011";
}
vi Mark(int N, int M, int A, int B, vi U, vi V) {
for (int i = 0; i < M; i++)
adj[U[i]].pb(i), adj[V[i]].pb(i);
vi X(M);
if (A > 2) {
deque<int> pq;
pq.pb(0);
fill(dp, dp+N, N+1);
dp[0] = 0;
for (int i = 0; i < M; i++)
X[i] = 2;
while (!pq.empty()) {
int u = pq.front(); pq.pop_front();
trav(x, adj[u]) {
int v = U[x]^V[x]^u;
if (dp[v] > dp[u] + 1) {
dp[v] = dp[u] + 1;
pq.pb(v);
}
if (dp[v] == dp[u] + 1 || dp[v] == dp[u]) {
X[x] = dp[u]%3;
}
}
}
return X;
}
function<void(int,int,int,int)> dfs = [&](int u, int p, int d, int l) {
if (u != 0 && sz(adj[u]) > 2) d = l ? 0 : 2;
trav(x, adj[u]) {
int v = U[x]^V[x]^u;
if (v != p) {
X[x] = bl[d%sz(bl)]-'0';
dfs(v, u, d+1, X[x]);
}
}
};
dfs(0, -1, 0, 0);
return X;
}
Compilation message
/tmp/ccJj5dd4.o: In function `main':
grader_catherine.cpp:(.text.startup+0x2ec): undefined reference to `Init(int, int)'
grader_catherine.cpp:(.text.startup+0xf34): undefined reference to `Move(std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status