Submission #627788

#TimeUsernameProblemLanguageResultExecution timeMemory
627788peti1234Rarest Insects (IOI22_insects)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #include "insects.h" const int c=2005; int cnt, si; bool v[c], fix[c]; int add(int a) { assert(!v[a]); v[a]=true; si++; move_inside(a); return press_buttom(); } void sub(int a) { assert(v[a]); v[a]=false; si--; move_outisde(a); } int min_cardinality(int N) { for (int i=0; i<N; i++) { if (add(i)==2) { sub(i); } else { cnt++; } } for (int i=0; i<N; i++) { if (v[i]) { fix[i]=1; } } int lo=1, hi=n/cnt+1; while (hi-lo>1) { mid=(hi+lo)/2; for (int i=0; i<N; i++) { if (fix[i]) continue; if (add(i)>mid) { sub(i); } } if (si==cnt*mid) { lo=mid; for (int i=0; i<N; i++) { if (v[i]) { fix[i]=1; } } } else { hi=mid; for (int i=0; i<N; i++) { if (fix[i]) continue; if (!v[i]) fix[i]=1; else { sub(i); } } } } return lo; } /* int main() { return 0; } */

Compilation message (stderr)

insects.cpp: In function 'int add(int)':
insects.cpp:13:12: error: 'press_buttom' was not declared in this scope; did you mean 'press_button'?
   13 |     return press_buttom();
      |            ^~~~~~~~~~~~
      |            press_button
insects.cpp: In function 'void sub(int)':
insects.cpp:19:5: error: 'move_outisde' was not declared in this scope; did you mean 'move_outside'?
   19 |     move_outisde(a);
      |     ^~~~~~~~~~~~
      |     move_outside
insects.cpp: In function 'int min_cardinality(int)':
insects.cpp:34:18: error: 'n' was not declared in this scope
   34 |     int lo=1, hi=n/cnt+1;
      |                  ^
insects.cpp:36:9: error: 'mid' was not declared in this scope
   36 |         mid=(hi+lo)/2;
      |         ^~~