Submission #1157721

#TimeUsernameProblemLanguageResultExecution timeMemory
1157721arkanefuryShopping (JOI21_shopping)C++20
0 / 100
61 ms8488 KiB
#include "Anna.h"
#include <vector>

namespace {

int N, L, R;
int count = 0, ans = 0;
}  // namespace

void InitA(int N, int L, int R) {
  ::N = N;
  ::L = L;
  ::R = R;
  int a[105];
  for(int i = 0; i < 18; i ++){
      a[i] = ((L >> i) & 1);
      SendA(a[i]);
  }
  for(int i = 0; i < 18; i ++){
      if((R >> i & 1) != (L >> i & 1) && !a[i])SendA(1);
      else if((R >> i & 1) != (L >> i & 1) && a[i])SendA(1);
      else SendA(0);
  }
}

void ReceiveA(bool x){
    if(x)ans += (1 << count);
    count ++;
}

int Answer() {
  return ans;
}
#include "Bruno.h"
#include <vector>

namespace {

int N;
int variable_example[1000000];
int count;

bool FunctionExample(bool P) {
  return !P;
}

}  // namespace

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

void ReceiveB(bool y){
    int L = 0, R = 0;
    int pl = 0;
    if(count < 18){
    if(y)L += (1 << count);
    }
    else{
        if(y)R += (1 << (count - 18));
        pl ++;
    }
    if(pl == 18){
        int ans = 1e9;
        for(int i = L; i <= R; i ++)ans = std::min(ans, variable_example[i]);
        for(int i = 0; i < 18; i ++)SendB(ans >> i & 1);
    }
    count++;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...