Submission #1071750

#TimeUsernameProblemLanguageResultExecution timeMemory
1071750TimDeeShopping (JOI21_shopping)C++17
Compilation error
0 ms0 KiB
#include "Anna.h" #include <bits/stdc++.h> using namespace std; #define forn(i,n) for(int i=0; i<n; ++i) int la, ra; void InitA(int n, int l, int r) { la = l, ra = r; forn(i,14) SendA((l>>i)&1); forn(i,4) SendA((r>>(i+10))&1); } int ai=-1; int mn = -1; void ReceiveA(bool x) { int b=x; if (ai==-1) { if (b) ++ai, mn=0; else ai=14; return; } if (ai<14) { mn+=b<<ai; ++ai; return; } if (la+ai-14 > ra) return; if (b) mn = la+ai-14; ++ai; } int Answer() { return mn; }
#include "Bruno.h" const int N=1e6+5; int a[N]; int n; void InitB(int n, vector<int> a) { forn(i,n) ::a[i]=a[i]; ::n=n; } int lq=0,rq=0; int bi=0; void ReceiveB(bool b) { int x = b; if (bi<14) { lq+=x<<bi; } else if (bi<18) { rq+=x<<(bi-4); } ++bi; if (bi==18) { int mn=-1; for(int i=lq; i<rq; ++i) { if (mn==-1) mn=i; if (a[i]<a[mn]) mn=i; } if (mn==-1) { SendB(0); } else { SendB(1); forn(i,14) SendB((mn>>i)&1); } for(int i=max(rq,lq); i<rq+1024; ++i) { if (mn==-1) mn=i; if (a[i]<a[mn]) mn=i; SendB(mn==i); } } }

Compilation message (stderr)

Bruno.cpp:5:19: error: 'vector' has not been declared
    5 | void InitB(int n, vector<int> a) {
      |                   ^~~~~~
Bruno.cpp:5:25: error: expected ',' or '...' before '<' token
    5 | void InitB(int n, vector<int> a) {
      |                         ^
Bruno.cpp: In function 'void InitB(int, int)':
Bruno.cpp:6:8: error: 'i' was not declared in this scope
    6 |   forn(i,n) ::a[i]=a[i];
      |        ^
Bruno.cpp:6:3: error: 'forn' was not declared in this scope
    6 |   forn(i,n) ::a[i]=a[i];
      |   ^~~~
Bruno.cpp: In function 'void ReceiveB(bool)':
Bruno.cpp:30:12: error: 'i' was not declared in this scope
   30 |       forn(i,14) SendB((mn>>i)&1);
      |            ^
Bruno.cpp:30:7: error: 'forn' was not declared in this scope
   30 |       forn(i,14) SendB((mn>>i)&1);
      |       ^~~~
Bruno.cpp:32:15: error: 'max' was not declared in this scope; did you mean 'std::max'?
   32 |     for(int i=max(rq,lq); i<rq+1024; ++i) {
      |               ^~~
      |               std::max
In file included from /usr/include/c++/10/vector:60,
                 from Bruno.h:1,
                 from Bruno.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:300:5: note: 'std::max' declared here
  300 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~