제출 #791130

#제출 시각아이디문제언어결과실행 시간메모리
791130Pablo_No기지국 (IOI20_stations)C++17
컴파일 에러
0 ms0 KiB
using namespace std; int count_mushrooms(int n) { std::vector<int> m; if(n == 2) { m = {0, 1}; return 2-use_machine(m); } m = { 0, 1, }; int a = use_machine(m); m = { 0, 2, }; int b = use_machine(m); bool usingb = false; vector<int> hep; int ans = 1 + (1-a) + (1-b); if(a == 0) { hep = { 0, 1 }; } else if(b == 0) { hep = { 0, 2 }; } else { hep = { 1, 2 }; usingb = true; } for(int i = 3; i+1 < n; i += 2) { m = { hep[0], i, hep[1], i+1 }; int def = use_machine(m); def = def%2 + def/2; if(!usingb) def = 2-def; ans += def; } if(n%2 != 1) { m = { 0, n-1 }; int e = use_machine(m); ans += (1-e); } return ans; }

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

stations.cpp: In function 'int count_mushrooms(int)':
stations.cpp:4:7: error: 'vector' is not a member of 'std'
    4 |  std::vector<int> m;
      |       ^~~~~~
stations.cpp:1:1: note: 'std::vector' is defined in header '<vector>'; did you forget to '#include <vector>'?
  +++ |+#include <vector>
    1 | using namespace std;
stations.cpp:4:14: error: expected primary-expression before 'int'
    4 |  std::vector<int> m;
      |              ^~~
stations.cpp:7:3: error: 'm' was not declared in this scope
    7 |   m = {0, 1};
      |   ^
stations.cpp:8:12: error: 'use_machine' was not declared in this scope
    8 |   return 2-use_machine(m);
      |            ^~~~~~~~~~~
stations.cpp:10:2: error: 'm' was not declared in this scope
   10 |  m = { 0, 1, };
      |  ^
stations.cpp:11:10: error: 'use_machine' was not declared in this scope
   11 |  int a = use_machine(m);
      |          ^~~~~~~~~~~
stations.cpp:15:2: error: 'vector' was not declared in this scope
   15 |  vector<int> hep;
      |  ^~~~~~
stations.cpp:15:2: note: 'std::vector' is defined in header '<vector>'; did you forget to '#include <vector>'?
stations.cpp:15:9: error: expected primary-expression before 'int'
   15 |  vector<int> hep;
      |         ^~~
stations.cpp:19:3: error: 'hep' was not declared in this scope
   19 |   hep = { 0, 1 };
      |   ^~~
stations.cpp:23:3: error: 'hep' was not declared in this scope
   23 |   hep = { 0, 2 };
      |   ^~~
stations.cpp:27:3: error: 'hep' was not declared in this scope
   27 |   hep = { 1, 2 };
      |   ^~~
stations.cpp:33:9: error: 'hep' was not declared in this scope
   33 |   m = { hep[0], i, hep[1], i+1 };
      |         ^~~