Submission #346053

#TimeUsernameProblemLanguageResultExecution timeMemory
346053athensclubCounting Mushrooms (IOI20_mushrooms)C++14
Compilation error
0 ms0 KiB
int div2RoundUp(int x) { int d = x / 2; if (d * 2 < x) return d + 1; return d; } int count_mushrooms(int n) { std::vector<int> m; for (int i = 0; i < n; i++) m.push_back(i); int c1 = use_machine(m); m = {0, 1}; int c2 = use_machine(m); return c2 == 1 ? div2RoundUp(c1) : n - div2RoundUp(c1); }

Compilation message (stderr)

mushrooms.cpp: In function 'int count_mushrooms(int)':
mushrooms.cpp:13:7: error: 'vector' is not a member of 'std'
   13 |  std::vector<int> m;
      |       ^~~~~~
mushrooms.cpp:1:1: note: 'std::vector' is defined in header '<vector>'; did you forget to '#include <vector>'?
  +++ |+#include <vector>
    1 | 
mushrooms.cpp:13:14: error: expected primary-expression before 'int'
   13 |  std::vector<int> m;
      |              ^~~
mushrooms.cpp:15:3: error: 'm' was not declared in this scope
   15 |   m.push_back(i);
      |   ^
mushrooms.cpp:16:23: error: 'm' was not declared in this scope
   16 |  int c1 = use_machine(m);
      |                       ^
mushrooms.cpp:16:11: error: 'use_machine' was not declared in this scope
   16 |  int c1 = use_machine(m);
      |           ^~~~~~~~~~~