제출 #1041743

#제출 시각아이디문제언어결과실행 시간메모리
1041743kheiraMemory (IOI10_memory)C++14
컴파일 에러
0 ms0 KiB
#include "grader.h" #include "memory.h" #include <map> #include <vector> using namespace std; void play() { unordered_map<char, vector<int>> Cards; vector<pair<int, int>> matchedCards; for (int C = 1; C <= 50; ++C) { char letterCard = faceup(C); if (Cards.find(letterCard) != Cards.end()) { int previousCard = Cards[letterCard][0]; matchedCards.push_back(make_pair(previousCard, C)); faceup(previousCard); faceup(C); } else { Cards[letterCard].push_back(C); } } }

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

memory.cpp: In function 'void play()':
memory.cpp:10:5: error: 'unordered_map' was not declared in this scope
   10 |     unordered_map<char, vector<int>> Cards;
      |     ^~~~~~~~~~~~~
memory.cpp:5:1: note: 'std::unordered_map' is defined in header '<unordered_map>'; did you forget to '#include <unordered_map>'?
    4 | #include <vector>
  +++ |+#include <unordered_map>
    5 | 
memory.cpp:10:19: error: expected primary-expression before 'char'
   10 |     unordered_map<char, vector<int>> Cards;
      |                   ^~~~
memory.cpp:16:13: error: 'Cards' was not declared in this scope
   16 |         if (Cards.find(letterCard) != Cards.end()) {
      |             ^~~~~