#include <bits/stdc++.h>
#include "Alice.h"
using namespace std;
// you may define some global variables, but it does not work if you try to transfer any information from function Alice() to function Bob() through these variables.
// you had better not use the same global variables in function Alice() and in function Bob().
const int N = 5000;
const int B = 750;
const int CNT = (N - B)/25;
vector<int> bits[25];
#define myrand( l , r , rng) uniform_int_distribution<int>(l , r)(rng)
std::vector<std::pair<int,int>> Alice(){
mt19937 rng1(1313);
mt19937 rng2(chrono::steady_clock::now().time_since_epoch().count());
vector<int> perm;
vector<pair<int ,int>> vp;
for(int i = 1 ; i <= N ; i++)
{
perm.push_back(i);
}
shuffle(perm.begin() , perm.end() , rng1);
vector<int> tree = {perm[0]};
for(int i = 1 ; i < B ; i++)
{
vp.push_back({perm[i] , perm[myrand(0 , (int)tree.size() - 1 , rng2)]});
tree.push_back(perm[i]);
}
assert((int)tree.size() == B);
for(int i = 0 ; i < 25 ; i++)
{
for(int j = B + i * CNT ; j < B + (i + 1) * CNT ; j++)
{
bits[i].push_back(perm[j]);
}
}
long long X = setN(N);
vector<int> all;
for(int i = 0 ; i < 25 ; i++)
{
if((1<<i) & X)
{
for(auto j : bits[i])
{
vp.push_back({tree[myrand(0 , (int)tree.size() - 1 , rng2)] , j});
all.push_back(j);
}
}
}
for(int i =0 ; i < 25 ; i++)
{
if((1<<i) & X)
continue;
for(auto j : bits[i])
{
vp.push_back({all[myrand(0 , (int)all.size() - 1 , rng2)] , j});
}
}
shuffle(vp.begin() , vp.end() , rng2);
assert((int)vp.size() == N - 1);
return vp;
}
Compilation message
/usr/bin/ld: /tmp/ccqW3NM9.o: in function `main':
grader_bob.cpp:(.text.startup+0x324): undefined reference to `Bob(std::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > >)'
collect2: error: ld returned 1 exit status