Submission #708949

#TimeUsernameProblemLanguageResultExecution timeMemory
708949kostia244Shopping (JOI21_shopping)C++17
0 / 100
66 ms12356 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...