답안 #298272

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
298272 2020-09-12T16:47:12 Z aloo123 Memory (IOI10_memory) C++14
컴파일 오류
0 ms 0 KB
// #include "grader.h"
#include "grader.h"
#include "memory.h"
#include <bits/stdc++.h>
char a[51];
bool vis[51];
map<char,pair<int,int>> m;
void play() {
    for(int i = 1;i<=50;i++){
        a[i] = faceup(i);        
    }
    for(int i =1;i<=50;i++){
        if(vis[i] == false) continue;
        for(int j = 1;j<=50;j++){
            if(vis[j] == false && a[i] == a[j]){
                m[a[i]] = make_pair(i,j);
                vis[j] = true;
                vis[i] = true;
                break;
            }
        }
    }
    for(char c = 'A';c<='Y';c++){
        faceup(m[c].first);
        faceup(m[c].second);
    }

}

Compilation message

memory.cpp:7:1: error: 'map' does not name a type
    7 | map<char,pair<int,int>> m;
      | ^~~
memory.cpp: In function 'void play()':
memory.cpp:16:17: error: 'm' was not declared in this scope
   16 |                 m[a[i]] = make_pair(i,j);
      |                 ^
memory.cpp:16:27: error: 'make_pair' was not declared in this scope; did you mean 'std::make_pair'?
   16 |                 m[a[i]] = make_pair(i,j);
      |                           ^~~~~~~~~
      |                           std::make_pair
In file included from /usr/include/c++/9/bits/stl_algobase.h:64,
                 from /usr/include/c++/9/bits/char_traits.h:39,
                 from /usr/include/c++/9/ios:40,
                 from /usr/include/c++/9/istream:38,
                 from /usr/include/c++/9/sstream:38,
                 from /usr/include/c++/9/complex:45,
                 from /usr/include/c++/9/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54,
                 from memory.cpp:4:
/usr/include/c++/9/bits/stl_pair.h:524:5: note: 'std::make_pair' declared here
  524 |     make_pair(_T1&& __x, _T2&& __y)
      |     ^~~~~~~~~
memory.cpp:24:16: error: 'm' was not declared in this scope
   24 |         faceup(m[c].first);
      |                ^