Submission #775121

#TimeUsernameProblemLanguageResultExecution timeMemory
775121cheat_when_I_was_youngShopping (JOI21_shopping)C++17
10 / 100
88 ms680 KiB
#include "Anna.h"
#include "bits/stdc++.h"
using namespace std;

namespace {

int n, l, r, ans;

}  // namespace

void InitA(int N, int L, int R) {
    ::n = N;
    ::l = L;
    ::r = R;
    for (int i = 0; i < 14; ++i) SendA((l >> i) & 1);
}

void ReceiveA(bool x) {
    if (l <= r && x) ans = l;
    l++;
}

int Answer() {
    return ans;
}
#include "Bruno.h"
#include "bits/stdc++.h"
using namespace std;

namespace {

const int NM = 1e6 + 5;
int n, p[NM], l, cnt, ans = 2e9;

}  // namespace

void InitB(int N, vector<int> P) {
    ::n = N;
    for(int i = 0; i < N; i++) p[i] = P[i];
}

void ReceiveB(bool y) {
    if (y) l |= 1 << cnt;
    ++cnt;
    if (cnt < 14) return;
    for (int i = l; i < n; ++i) {
        if (ans <= p[i]) {
            SendB(0);
            continue;
        }
        ans = p[i];
        SendB(1);
    }
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...