Submission #399096

#TimeUsernameProblemLanguageResultExecution timeMemory
399096AntekbCounting Mushrooms (IOI20_mushrooms)C++14
Compilation error
0 ms0 KiB
#include "mushrooms.h" #include<bits/stdc++.h> #define st first #define nd second #define pb(x) push_back(x) using namespace std; int count_mushrooms(int n) { vector<int> A, B, C(n-1); A.pb(0); iota(C.begin(), C.end(), 1); int k=400; for(int i=0; i<k && size(C); i++){ int c1 = use_machine({0, C.back()}); if(c1==1)B.pb(C.back()); else A.pb(C.back()); C.pop_back(); } bool swa=0; if(A.size()<B.size()){ swap(A, B); swa=1; } int a=size(A),b=size(B); while(C.size()){ int t=min(A.size(), C.size()); vector<int> V; for(int i=0; i<t; i++){ V.pb(A[i]); V.pb(C.back()); C.pop_back(); } int c=use_machine(V); b+=(c+1)/2; a+=t-(c+1)/2; } if(swa)swap(a, b); return a; }

Compilation message (stderr)

mushrooms.cpp: In function 'int count_mushrooms(int)':
mushrooms.cpp:12:22: error: 'size' was not declared in this scope; did you mean 'dysize'?
   12 |  for(int i=0; i<k && size(C); i++){
      |                      ^~~~
      |                      dysize
mushrooms.cpp:23:8: error: 'size' was not declared in this scope; did you mean 'dysize'?
   23 |  int a=size(A),b=size(B);
      |        ^~~~
      |        dysize
mushrooms.cpp:33:3: error: 'b' was not declared in this scope
   33 |   b+=(c+1)/2;
      |   ^
mushrooms.cpp:36:17: error: 'b' was not declared in this scope
   36 |  if(swa)swap(a, b);
      |                 ^