// Source: https://usaco.guide/general/io
#include <bits/stdc++.h>
#include <Alice.h>
using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<ll,ll>;
ld seed = 0.1434;
ld getseed() {
seed = 3.67*seed*(1.0-seed);
return seed;
}
ll getrng(ll x) { //random integer in [0,x-1]
return (((ll) round(1000000000000*getseed()))%x);
}
ll l2(ll x) {
return (31-__builtin_clz(x));
}
vector<pair<int,int>> Alice() {
ll N = 5000;
ll X = setN((int) N);
vector<pair<int,int>> vout;
vector<bool> xv;
ll E = 60;
for (ll e=59;e>=0;e--) {
xv.push_back((X>>e)%2);
}
for (ll n=1;n<N;n++) {
ll D = l2(n)-1;
ll val = 0;
for (ll d=0;d<D;d++) {
ll e = getrng(E);
val += xv[e]*(1LL<<d);
}
vout.push_back({val+1,n+1});
}
return vout;
}
long long Bob(vector<pair<int,int>> V) {
ll N = 5000;
ll vals[N];
for (ll i=0;i<N;i++) {
vals[i]=-1;
}
for (pii p0: V) {
vals[p0.second-1]=p0.first-1;
}
vector<ll> xv;
ll E = 60;
for (ll e=59;e>=0;e--) {
xv.push_back(-1);
}
for (ll n=1;n<N;n++) {
ll D = l2(n)-1;
ll val = 0;
for (ll d=0;d<D;d++) {
ll e = getrng(E);
//val += xv[e]*(1LL<<d);
if (vals[n]!=-1) {
xv[e]=vals[n]>>d;
}
}
}
ll X = 0;
for (ll e=0;e<E;e++) {
X += xv[e]*(1LL<<(E-1-e));
}
return X;
}
// Source: https://usaco.guide/general/io
#include <bits/stdc++.h>
#include <Bob.h>
using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<ll,ll>;
ld seed = 0.1434;
ld getseed() {
seed = 3.67*seed*(1.0-seed);
return seed;
}
ll getrng(ll x) { //random integer in [0,x-1]
return (((ll) round(1000000000000*getseed()))%x);
}
ll l2(ll x) {
return (31-__builtin_clz(x));
}
vector<pair<int,int>> Alice() {
ll N = 5000;
ll X = setN((int) N);
vector<pair<int,int>> vout;
vector<bool> xv;
ll E = 60;
for (ll e=59;e>=0;e--) {
xv.push_back((X>>e)%2);
}
for (ll n=1;n<N;n++) {
ll D = l2(n)-1;
ll val = 0;
for (ll d=0;d<D;d++) {
ll e = getrng(E);
val += xv[e]*(1LL<<d);
}
vout.push_back({val+1,n+1});
}
return vout;
}
long long Bob(vector<pair<int,int>> V) {
ll N = 5000;
ll vals[N];
for (ll i=0;i<N;i++) {
vals[i]=-1;
}
for (pii p0: V) {
vals[p0.second-1]=p0.first-1;
}
vector<ll> xv;
ll E = 60;
for (ll e=59;e>=0;e--) {
xv.push_back(-1);
}
for (ll n=1;n<N;n++) {
ll D = l2(n)-1;
ll val = 0;
for (ll d=0;d<D;d++) {
ll e = getrng(E);
//val += xv[e]*(1LL<<d);
if (vals[n]!=-1) {
xv[e]=vals[n]>>d;
}
}
}
ll X = 0;
for (ll e=0;e<E;e++) {
X += xv[e]*(1LL<<(E-1-e));
}
return X;
}
Compilation message
Alice.cpp: In function 'long long int Bob(std::vector<std::pair<int, int> >)':
Alice.cpp:61:6: warning: unused variable 'val' [-Wunused-variable]
61 | ll val = 0;
| ^~~
Bob.cpp: In function 'std::vector<std::pair<int, int> > Alice()':
Bob.cpp:26:9: error: 'setN' was not declared in this scope
26 | ll X = setN((int) N);
| ^~~~
Bob.cpp: In function 'long long int Bob(std::vector<std::pair<int, int> >)':
Bob.cpp:61:6: warning: unused variable 'val' [-Wunused-variable]
61 | ll val = 0;
| ^~~