제출 #347803

#제출 시각아이디문제언어결과실행 시간메모리
347803ponkung버섯 세기 (IOI20_mushrooms)C++14
컴파일 에러
0 ms0 KiB
#include "mushrooms.h" int count_mushrooms(int n) { /*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 c1+c2;*/ vector<int> v; int it=1,cnt=1,op; for(int i=1;i<n;i++) { v.push_back(i-1); v.push_back(i); op=use_machine(v); v.clear(); if(op==2) { it=1-it; } if(it==1) { ++cnt; } } return cnt; }

컴파일 시 표준 에러 (stderr) 메시지

mushrooms.cpp: In function 'int count_mushrooms(int)':
mushrooms.cpp:11:2: error: 'vector' was not declared in this scope; did you mean 'std::vector'?
   11 |  vector<int> v;
      |  ^~~~~~
      |  std::vector
In file included from /usr/include/c++/9/vector:67,
                 from mushrooms.h:1,
                 from mushrooms.cpp:1:
/usr/include/c++/9/bits/stl_vector.h:386:11: note: 'std::vector' declared here
  386 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
mushrooms.cpp:11:9: error: expected primary-expression before 'int'
   11 |  vector<int> v;
      |         ^~~
mushrooms.cpp:15:3: error: 'v' was not declared in this scope
   15 |   v.push_back(i-1);
      |   ^