Submission #1157716

#TimeUsernameProblemLanguageResultExecution timeMemory
1157716arkanefuryShopping (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; if(count < 18){ if(y)L += (1 << count); } int pl = 0; else{ if(y)R += (1 << (count - 18)); pl ++; } if(pl == 18){ ans = 1e18; FOR(i, L, R, 1)ans = min(ans, variable_example[i]); FOR(i, 0, 20, 1)sendB(ans >> i & 1); } count++; }

Compilation message (stderr)

# 2번째 컴파일 단계

Bruno.cpp: In function 'void ReceiveB(bool)':
Bruno.cpp:30:5: error: 'else' without a previous 'if'
   30 |     else{
      |     ^~~~
Bruno.cpp:35:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   35 |         ans = 1e18;
      |         ^~~
      |         abs
Bruno.cpp:36:13: error: 'i' was not declared in this scope
   36 |         FOR(i, L, R, 1)ans = min(ans, variable_example[i]);
      |             ^
Bruno.cpp:36:9: error: 'FOR' was not declared in this scope
   36 |         FOR(i, L, R, 1)ans = min(ans, variable_example[i]);
      |         ^~~