Submission #1157719

#TimeUsernameProblemLanguageResultExecution timeMemory
1157719arkanefuryShopping (JOI21_shopping)C++20
Compilation error
0 ms0 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){
        ans = 1e18;
        for(int i = L; i <= R; i ++)ans = min(ans, variable_example[i]);
        for(int i = 0; i < 18; i ++)SendB(ans >> i & 1);
    }
    count++;
}

Compilation message (stderr)

# 2번째 컴파일 단계

Bruno.cpp: In function 'void ReceiveB(bool)':
Bruno.cpp:35:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   35 |         ans = 1e18;
      |         ^~~
      |         abs
Bruno.cpp:36:43: error: 'min' was not declared in this scope; did you mean 'std::min'?
   36 |         for(int i = L; i <= R; i ++)ans = min(ans, variable_example[i]);
      |                                           ^~~
      |                                           std::min
In file included from /usr/include/c++/11/vector:62,
                 from Bruno.h:1,
                 from Bruno.cpp:1:
/usr/include/c++/11/bits/stl_algo.h:3455:5: note: 'std::min' declared here
 3455 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~