#include <bits/stdc++.h>
#include "Boblib.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define fi first
#define se second
#define all(v) (v).begin(), (v).end()
#define fillchar(a, s) memset((a), (s), sizeof(a))
void Bob (int N, int M, int C[], int D[]) {
//toposort!
vector<vector<int>> adj(N);
vector<int> indeg(N);
vector<int> ind(N);
for (int i = 0; i < M; i++) {
adj[C[i]].push_back(D[i]);
indeg[D[i]]++;
}
//toposort
vector<int> topo = vector<int> ();
stack<int> stk = stack<int> ();
for (int i = 0; i < N; i++) {
if (indeg[i] == 0) {
stk.push(i);
}
}
while (!stk.empty()) {
int x = stk.top();
stk.pop();
ind[x] = topo.size();
topo.push_back(x);
for (int y : adj[x]) {
if (--indeg[y] == 0) {
stk.push(y);
}
}
}
vector<pii> ans = vector<pii> ();
int last = topo.back();
for (int x : topo) {
if (x == last) {
break;
}
bool existlast = false;
for (int y : adj[x]) {
if (y == last) {
existlast = true;
} else if (y != topo[ind[x] + 1]) {
ans.push_back(pii(ind[x], ind[y]));
}
}
if (!existlast) {
//then x, x + 1
ans.push_back(pii(ind[x], ind[x] + 1));
}
}
//FINAL ANSWERS!
InitMap(N - 1, ans.size());
for (pii p : ans) {
MakeMap(p.fi, p.se);
}
}
#include <bits/stdc++.h>
#include "Boblib.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
static const int MAXN = 1010;
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define fi first
#define se second
#define all(v) (v).begin(), (v).end()
#define fillchar(a, s) memset((a), (s), sizeof(a))
static vector<int> adj[MAXN];
static int indeg[MAXN];
static int ind[MAXN];
void Bob (int N, int M, int C[], int D[]) {
//toposort!
for (int i = 0; i < MAXN; i++) {
adj[i].clear();
indeg[i] = 0;
ind[i] = 0;
}
for (int i = 0; i < M; i++) {
adj[C[i]].push_back(D[i]);
indeg[D[i]]++;
}
//toposort
vector<int> topo = vector<int> ();
stack<int> stk = stack<int> ();
for (int i = 0; i < N; i++) {
if (indeg[i] == 0) {
stk.push(i);
}
}
while (!stk.empty()) {
int x = stk.top();
stk.pop();
ind[x] = topo.size();
topo.push_back(x);
for (int y : adj[x]) {
if (--indeg[y] == 0) {
stk.push(y);
}
}
}
vector<pii> ans = vector<pii> ();
int last = topo.back();
for (int x : topo) {
if (x == last) {
break;
}
bool existlast = false;
for (int y : adj[x]) {
if (y == last) {
existlast = true;
} else if (y != topo[ind[x] + 1]) {
ans.push_back(pii(ind[x], ind[y]));
}
}
if (!existlast) {
//then x, x + 1
ans.push_back(pii(ind[x], ind[x] + 1));
}
}
//FINAL ANSWERS!
InitMap(N - 1, ans.size());
for (pii p : ans) {
MakeMap(p.fi, p.se);
}
}
Compilation message
/tmp/ccCfxu5J.o: In function `main':
grader_alice.cpp:(.text.startup+0xe0): undefined reference to `Alice(int, int, int*, int*)'
/tmp/ccXOWE4H.o: In function `Bob(int, int, int*, int*)':
Alice.cpp:(.text+0x4df): undefined reference to `InitMap(int, int)'
Alice.cpp:(.text+0x4fe): undefined reference to `MakeMap(int, int)'
collect2: error: ld returned 1 exit status