제출 #518491

#제출 시각아이디문제언어결과실행 시간메모리
518491nurlitadfMemory (IOI10_memory)C++17
컴파일 에러
0 ms0 KiB
#include "grader.h" #include "memory.h" #include <bits/stdc++.h> void play() { int i; vector<int> card(25, 0); for (int i = 1; i < 50; i += 2) { char a = faceup(i); char b = faceup(i + 1); if(a != b) { if(card[a - 'A']) { faceup(i); faceup(card[a - 'A']); } else { card[a - 'A'] = i; } if(card[b - 'A']) { faceup(i + 1); faceup(card[b - 'A']); } else { card[b - 'A'] = i + 1; } } } }

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

memory.cpp: In function 'void play()':
memory.cpp:8:4: error: 'vector' was not declared in this scope
    8 |    vector<int> card(25, 0);
      |    ^~~~~~
memory.cpp:8:4: note: suggested alternatives:
In file included from /usr/include/c++/10/vector:67,
                 from /usr/include/c++/10/functional:62,
                 from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from memory.cpp:4:
/usr/include/c++/10/bits/stl_vector.h:389:11: note:   'std::vector'
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
In file included from /usr/include/c++/10/functional:62,
                 from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from memory.cpp:4:
/usr/include/c++/10/vector:86:13: note:   'std::pmr::vector'
   86 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
memory.cpp:8:11: error: expected primary-expression before 'int'
    8 |    vector<int> card(25, 0);
      |           ^~~
memory.cpp:15:13: error: 'card' was not declared in this scope
   15 |          if(card[a - 'A']) {
      |             ^~~~
memory.cpp:22:13: error: 'card' was not declared in this scope
   22 |          if(card[b - 'A']) {
      |             ^~~~
memory.cpp:7:8: warning: unused variable 'i' [-Wunused-variable]
    7 |    int i;
      |        ^