This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "Anna.h"
#include "bits/stdc++.h"
using namespace std;
int n, l, r, ans;
mt19937 rd(1975);
void InitA(int N, int L, int R) {
n = N;
l = L;
r = R;
int st, en;
if (n < (1<<18)) {
st = 0;
en = 17;
} else {
l -= l % 4;
st = 2;
en = 19;
}
for (int i = st; i <= en; ++i) SendA((l >> i) & 1);
}
void ReceiveA(bool x) {
if (n < (1<<18)) {
if (l <= r && x) ans = l;
++l;
} else {
int i = rd() % n;
while (i < l) i = rd() % n;
if (i <= r && x) ans = i;
}
}
int Answer() {
return ans;
}
#include "Bruno.h"
#include "bits/stdc++.h"
using namespace std;
int n, l, cnt, stop = 18, ans = 2e9;
vector<int> p;
mt19937 rd(1975);
void InitB(int N, vector<int> P) {
n = N;
p = P;
if (n >= (1<<18)) {
cnt = 2;
stop = 20;
}
}
void ReceiveB(bool y) {
if (y) l |= 1 << cnt;
++cnt;
if (cnt < stop) return;
if (n < (1<<18)) {
for (int i = l; i < n; ++i) {
if (ans <= p[i]) {
SendB(0);
continue;
}
ans = p[i];
SendB(1);
}
} else {
for (int j = 0; j < 10000; ++j) {
int i = rd() % n;
while (i < l) i = rd() % n;
if (ans <= p[i]) {
SendB(0);
continue;
}
ans = p[i];
SendB(1);
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |