Submission #1222647

#TimeUsernameProblemLanguageResultExecution timeMemory
122264712345678Shopping (JOI21_shopping)C++20
0 / 100
67 ms12356 KiB
#include "Anna.h"
#include <bits/stdc++.h>

using namespace std;

namespace {

int N, L, R, cnt, ans;

}  // namespace

void InitA(int N, int L, int R) {
    ::N = N;
    ::L = L;
    ::R = R;
    for (int i=13; i>=0; i--) SendA((L>>i)&1);
}

void ReceiveA(bool x) {
    if (x&&L+cnt<=R) ans=L+(cnt++);
}

int Answer() {
    return ans;
}
#include "Bruno.h"
#include <bits/stdc++.h>

using namespace std;

namespace {

int N, l=0, cnt=13;
vector<int> p;

}

void InitB(int N, std::vector<int> P) {
    ::N = N;
    p=P;
}

void ReceiveB(bool y) {
    l|=(y<<cnt);
    cnt--;
    if (cnt<0)
    {
        cout<<"l "<<l<<'\n';
        int mn=INT_MAX;
        for (int i=l; i<N; i++)
        {
            if (p[i]<mn) SendB(1), mn=p[i];
            else SendB(0);
        }
    }
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...