제출 #198828

#제출 시각아이디문제언어결과실행 시간메모리
198828Markomafko972Memory (IOI10_memory)C++14
컴파일 에러
0 ms0 KiB
#include "grader.h" #include "memory.h" #include <vector> void play() { vector<int> v[50]; for (int i = 1; i <= 50; i++) v[i].clear(); for (int i = 1; i <= 50; i+= 2) { char c1 = faceup(i); char c2 = faceup(i+1); if (c1 != c2) { v[c1-'A'+1].push_back(i); v[c2-'A'+1].push_back(i+1); } } for (int i = 1; i <= 50; i++) { if (v[i].size() == 2) { faceup(v[i][0]); faceup(v[i][1]); } } }

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

memory.cpp: In function 'void play()':
memory.cpp:6:2: error: 'vector' was not declared in this scope
  vector<int> v[50];
  ^~~~~~
memory.cpp:6:2: note: suggested alternative:
In file included from /usr/include/c++/7/vector:64:0,
                 from memory.cpp:3:
/usr/include/c++/7/bits/stl_vector.h:216:11: note:   'std::vector'
     class vector : protected _Vector_base<_Tp, _Alloc>
           ^~~~~~
memory.cpp:6:9: error: expected primary-expression before 'int'
  vector<int> v[50];
         ^~~
memory.cpp:7:32: error: 'v' was not declared in this scope
  for (int i = 1; i <= 50; i++) v[i].clear();
                                ^
memory.cpp:12:4: error: 'v' was not declared in this scope
    v[c1-'A'+1].push_back(i);
    ^
memory.cpp:18:7: error: 'v' was not declared in this scope
   if (v[i].size() == 2) {
       ^