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;
namespace {
int N, L, R;
int best, pos;
} // namespace
void InitA(int N, int L, int R) {
::N = N;
::L = L;
::R = R;
best = pos = L;
for(int i = 0; i < 18; i++)
SendA((L >> i) & 1);
}
void ReceiveA(bool x) {
++pos;
if(pos <= R && x)
best = pos;
}
int Answer() {
return best;
}
#include "Bruno.h"
#include <bits/stdc++.h>
using namespace std;
namespace {
int n, start, cnt;
vector<int> p;
} // namespace
void InitB(int N, std::vector<int> P) {
n = N;
p = P;
start = 0;
cnt = 0;
}
void ReceiveB(bool y) {
start |= y << cnt++;
if(cnt == 18) {
int mn = p[start];
for(int i = start + 1; i < n; i++) {
SendB(mn > p[i]);
mn = min(mn, p[i]);
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |