제출 #717676

#제출 시각아이디문제언어결과실행 시간메모리
717676nikosMemory (IOI10_memory)C++17
컴파일 에러
0 ms0 KiB
#include "grader.h"
#include "memory.h"
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <tuple>
#include <queue>
#include <stack>
#include <cmath>
#define pb push_back
#define ll long long
void play() {
    char a, b;
    vector< pair<int, int> > v;
    for(int i = 0; i < 25; i++){
        v.pb(make_pair(0, 0));
    }
    for(int i = 1; i < 50; i += 2){
        a = faceup(i);
        b = faceup(i + 1);
        if(v[a - 'A'].first != 0){
            v[a - 'A'].first = i;
        }
        else{
            v[a - 'A'].second = i;
        }
        if(v[b - 'A'].first != 0){
            v[b - 'A'].first = i;
        }
        else{
            v[b - 'A'].second = i;
        }
    }
    for(int i = 0; i < v.size(); i++){
        faceup(v[i].first);
        faceup(v[i].second);
    }
    return;
}

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

memory.cpp: In function 'void play()':
memory.cpp:15:5: error: 'vector' was not declared in this scope
   15 |     vector< pair<int, int> > v;
      |     ^~~~~~
memory.cpp:15:5: note: suggested alternatives:
In file included from /usr/include/c++/10/vector:67,
                 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 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:15:13: error: 'pair' was not declared in this scope; did you mean 'std::pair'?
   15 |     vector< pair<int, int> > v;
      |             ^~~~
      |             std::pair
In file included from /usr/include/c++/10/bits/stl_algobase.h:64,
                 from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/ios:40,
                 from /usr/include/c++/10/ostream:38,
                 from /usr/include/c++/10/iostream:39,
                 from memory.cpp:3:
/usr/include/c++/10/bits/stl_pair.h:211:12: note: 'std::pair' declared here
  211 |     struct pair
      |            ^~~~
memory.cpp:15:18: error: expected primary-expression before 'int'
   15 |     vector< pair<int, int> > v;
      |                  ^~~
memory.cpp:17:9: error: 'v' was not declared in this scope
   17 |         v.pb(make_pair(0, 0));
      |         ^
memory.cpp:17:14: error: 'make_pair' was not declared in this scope; did you mean 'std::make_pair'?
   17 |         v.pb(make_pair(0, 0));
      |              ^~~~~~~~~
      |              std::make_pair
In file included from /usr/include/c++/10/bits/stl_algobase.h:64,
                 from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/ios:40,
                 from /usr/include/c++/10/ostream:38,
                 from /usr/include/c++/10/iostream:39,
                 from memory.cpp:3:
/usr/include/c++/10/bits/stl_pair.h:567:5: note: 'std::make_pair' declared here
  567 |     make_pair(_T1&& __x, _T2&& __y)
      |     ^~~~~~~~~
memory.cpp:22:12: error: 'v' was not declared in this scope
   22 |         if(v[a - 'A'].first != 0){
      |            ^
memory.cpp:28:12: error: 'v' was not declared in this scope
   28 |         if(v[b - 'A'].first != 0){
      |            ^
memory.cpp:35:24: error: 'v' was not declared in this scope
   35 |     for(int i = 0; i < v.size(); i++){
      |                        ^