Submission #303734

#TimeUsernameProblemLanguageResultExecution timeMemory
303734denkendoemeerCounting Mushrooms (IOI20_mushrooms)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; int count_mushrooms(int n) { vector<int>nr[2]; vector<int>aux; nr[0].push_back(0); int i,lim=130,ok,cnt=0,rez,ok2,ram,j; for(i=1;i<n && max(nr[0].size(),nr[1].size())<2;i++) nr[use_machine({0,i})].push_back(i); if (nr[1].size()==2) ok=1; else ok=0; for(;i<n && max(nr[0].size(),nr[1].size())<lim;i=i+2) { if (i+1<n) rez=use_machine({nr[ok][0],i,nr[ok][1],i+1}); else rez=use_machine({nr[ok][0],i,nr[ok][1]}); if (rez&2) ok2=1; else ok2=0; nr[ok^ok2].push_back(i); if (i+1<n) ok2=rez&1,nr[ok^ok2].push_back(i+1); } while(i<n) { if (nr[1].size()==max(nr[0].size(),nr[1].size())) ok=1; else ok=0; ram=min((int)max(nr[0].size(),nr[1].size()),n-i); aux.clear(); for(j=0;j<ram;j++) aux.push_back(nr[ok][j]),aux.push_back(i+j); rez=use_machine(aux); if (rez%2==1) rez++; if (ok) cnt=cnt+rez/2; else cnt=cnt+rez-rez/2; i+=ram; } return nr[0].size()+cnt; }

Compilation message (stderr)

mushrooms.cpp: In function 'int count_mushrooms(int)':
mushrooms.cpp:10:12: error: 'use_machine' was not declared in this scope
   10 |         nr[use_machine({0,i})].push_back(i);
      |            ^~~~~~~~~~~
mushrooms.cpp:15:47: warning: comparison of integer expressions of different signedness: 'const long unsigned int' and 'int' [-Wsign-compare]
   15 |     for(;i<n && max(nr[0].size(),nr[1].size())<lim;i=i+2)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
mushrooms.cpp:18:17: error: 'use_machine' was not declared in this scope
   18 |             rez=use_machine({nr[ok][0],i,nr[ok][1],i+1});
      |                 ^~~~~~~~~~~
mushrooms.cpp:20:17: error: 'use_machine' was not declared in this scope
   20 |             rez=use_machine({nr[ok][0],i,nr[ok][1]});
      |                 ^~~~~~~~~~~
mushrooms.cpp:39:11: error: 'use_machine' was not declared in this scope
   39 |       rez=use_machine(aux);
      |           ^~~~~~~~~~~