Submission #1157733

#TimeUsernameProblemLanguageResultExecution timeMemory
1157733arkanefuryShopping (JOI21_shopping)C++20
Compilation error
0 ms0 KiB
#include "Anna.h"
#include <vector>

namespace {

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

void InitA(int N, int L, int R) {
  ::N = N;
  ::L = L;
  ::R = R;
  int a[105];
  for(int i = 0; i < 8; i ++){
      a[i] = ((L >> i) & 1);
  }
  count = 0;
}

void ReceiveA(bool x){
    if(x)sum += (1 << count);
    count ++;
    if(count == 10)a[k] = sum, k ++, count = 0;
    if(k == n){
        int ans = 1e9;
        for(int i = L; i <= R; i ++)ans = std::min(ans, a[i]);
        Answer();
    }
}

void Answer() {
  return ans;
  exit(0);
}
#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++){
    for(int j = 0, j < 10)SendB(P[i] >> j & 1);
  }
}

void ReceiveB(bool y){
    
}

Compilation message (stderr)

# 1번째 컴파일 단계

Anna.cpp: In function 'void ReceiveA(bool)':
Anna.cpp:24:20: error: 'a' was not declared in this scope
   24 |     if(count == 10)a[k] = sum, k ++, count = 0;
      |                    ^
Anna.cpp:25:13: error: 'n' was not declared in this scope
   25 |     if(k == n){
      |             ^
Anna.cpp:27:57: error: 'a' was not declared in this scope
   27 |         for(int i = L; i <= R; i ++)ans = std::min(ans, a[i]);
      |                                                         ^
Anna.cpp: At global scope:
Anna.cpp:32:6: error: ambiguating new declaration of 'void Answer()'
   32 | void Answer() {
      |      ^~~~~~
In file included from Anna.cpp:1:
Anna.h:3:5: note: old declaration 'int Answer()'
    3 | int Answer();
      |     ^~~~~~
Anna.cpp: In function 'void Answer()':
Anna.cpp:33:10: error: return-statement with a value, in function returning 'void' [-fpermissive]
   33 |   return ans;
      |          ^~~