#include <bits/stdc++.h>
#include "Alicelib.h"
using namespace std;
#define bit(i, x) (((x) >> (i)) & 1)
void Alice(int n, int m, vector<int> a, vector<int> b)
{
vector<pair<int, int>> s;
for (int i = 0; i < m; ++i)
s.emplace_back(a[i], b[i]);
for (int j = 0; j < 10; ++j)
{
for (int i = 0; i < n; ++i)
if (bit(j, i))
s.emplace_back(n + j, i);
if (j + 1 < 10)
s.emplace_back(j, j + 1);
}
for (int i = 0; i < n; ++i)
s.emplace_back(n + 10, i);
for (int i = 0; i < n + 10; ++i)
s.emplace_back(n + 11, i);
InitG(n + 12, s.size());
int pos(0);
for (auto i : s)
MakeG(pos++, i.first, i.second);
}
#include <bits/stdc++.h>
#include "Boblib.h"
using namespace std;
#define bit(i, x) (((x) >> (i)) & 1)
void Bob(int n, int m, vector<int> a, vector<int> b)
{
int ten(-1), elv(-1), nin(-1), zer(-1);
vector<vector<bool>> adj(n, vector<bool>(n));
vector<pair<int, int>> s;
vector<int> cnt(n), real(n), son(n), obit, dep(n), pos(10), tmp;
for (int i = 0; i < m; ++i)
{
adj[a[i]][b[i]] = 1;
++cnt[a[i]];
adj[b[i]][a[i]] = 1;
++cnt[b[i]];
}
/// Find elevent and ten
for (int i = 0; i < n; ++i)
if (cnt[i] == n - 1)
{
for (int j = 0; j < n; ++j)
if (i != j && !adj[i][j] && cnt[j] == n - 12)
{
ten = j;
elv = i;
break;
}
if (ten != -1)
break;
}
/// find bit
auto bfs = [&](int v) {
fill(dep.begin(), dep.end(), 0);
dep[v] = 1;
queue<int> q;
q.emplace(v);
while (q.size())
{
int c = q.front();
q.pop();
pos[dep[c] - 1] = c;
for (auto i : obit)
if (!dep[i] && adj[c][i])
{
++son[c];
dep[i] = dep[v] + 1;
}
}
};
for (int i = 0; i < n; ++i)
if (i != elv && !adj[ten][i])
obit.emplace_back(i);
bfs(obit[0]);
for (auto i : obit)
if (son[i] == 0)
tmp.emplace_back(i);
if (tmp.size() == 1)
bfs(cnt[tmp.back()] > cnt[obit[0]] ? tmp.back() : obit[0]);
else
bfs(cnt[tmp[0]] > cnt[tmp[1]] ? tmp[0] : tmp[1]);
for (int i = 0; i < 10; ++i)
for (int j = 0; j < n; ++j)
if (adj[pos[i]][j])
real[j] |= 1 << i;
for (int i = 0; i < n; ++i)
if (adj[ten][i])
for (int j = i + 1; j < n; ++j)
if (adj[ten][j])
s.emplace_back(real[i], real[j]);
InitG(n - 12, s.size());
for (auto i : s)
MakeG(i.first, i.second);
}
Compilation message
/tmp/ccHBpf3M.o: In function `main':
grader_alice.cpp:(.text.startup+0x108): undefined reference to `Alice(int, int, int*, int*)'
collect2: error: ld returned 1 exit status
Bob.cpp: In function 'void Bob(int, int, std::vector<int>, std::vector<int>)':
Bob.cpp:71:5: error: 'InitG' was not declared in this scope
71 | InitG(n - 12, s.size());
| ^~~~~
Bob.cpp:73:9: error: 'MakeG' was not declared in this scope; did you mean 'MakeMap'?
73 | MakeG(i.first, i.second);
| ^~~~~
| MakeMap
Bob.cpp:7:27: warning: unused variable 'nin' [-Wunused-variable]
7 | int ten(-1), elv(-1), nin(-1), zer(-1);
| ^~~
Bob.cpp:7:36: warning: unused variable 'zer' [-Wunused-variable]
7 | int ten(-1), elv(-1), nin(-1), zer(-1);
| ^~~