Submission #884482

#TimeUsernameProblemLanguageResultExecution timeMemory
884482weajinkCounting Mushrooms (IOI20_mushrooms)C++17
Compilation error
0 ms0 KiB
#include "mushrooms.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; #ifdef LOCAL #define debug(...) __VA_ARGS__ #else #define debug(...) {} #endif int count_mushrooms(int n){ vector<int> znane[2]; znane[0].push_back(0); int ile[2] = {0}; int akt = 1; while (akt < n){ bool better = (znane[0].size()<znane[1].size()); int pt = 0; vector<int> zap; for (; akt < n && pt < znane[better].size(); akt++,pt++){ zap.push_back(znane[better][pt]); zap.push_back(akt); } int wy = use_machine(zap); if (wy%2) znane[!better].push_back(akt-1); else znane[better].push_back(akt-1); ile[better].push_back(pom1-(wy+1)/2); ile[!better].push_back((wy+1)/2); } return ile[0]; }

Compilation message (stderr)

mushrooms.cpp: In function 'int count_mushrooms(int)':
mushrooms.cpp:20:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |         for (; akt < n && pt < znane[better].size(); akt++,pt++){
      |                           ~~~^~~~~~~~~~~~~~~~~~~~~~
mushrooms.cpp:27:21: error: request for member 'push_back' in 'ile[((int)better)]', which is of non-class type 'int'
   27 |         ile[better].push_back(pom1-(wy+1)/2);
      |                     ^~~~~~~~~
mushrooms.cpp:27:31: error: 'pom1' was not declared in this scope
   27 |         ile[better].push_back(pom1-(wy+1)/2);
      |                               ^~~~
mushrooms.cpp:28:22: error: request for member 'push_back' in 'ile[((int)(! better))]', which is of non-class type 'int'
   28 |         ile[!better].push_back((wy+1)/2);
      |                      ^~~~~~~~~