답안 #347052

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
347052 2021-01-11T15:44:46 Z ACmachine 질문 (CEOI14_question_grader) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
int encode (int n, int x, int y) {
    vector<int> sets(921, 0);
    int id = 1;
    for(int i = 0; i < 12; ++i){
        for(int j = i + 1; j < 12; ++j){
            for(int k = j + 1; k < 12; ++k){
                for(int g = k + 1; g < 12; ++g){
                    for(int l = g + 1; l < 12; ++l){
                        for(int m = l + 1; m < 12; ++m){
                            sets[id++] = (1 << i) | (1 << j) | (1 << k) | (1 << g) | (1 << l) | (1 << m);
                        }
                    }
                }
            }
        }
    }
    return sets[x]&~sets[y]; 
}
#include <bits/stdc++.h>
int decode (int n, int q, int h) {
    vector<int> sets(921, 0);
    int id = 1;
    for(int i = 0; i < 12; ++i){
        for(int j = i + 1; j < 12; ++j){
            for(int k = j + 1; k < 12; ++k){
                for(int g = k + 1; g < 12; ++g){
                    for(int l = g + 1; l < 12; ++l){
                        for(int m = l + 1; m < 12; ++m){
                            sets[id++] = (1 << i) | (1 << j) | (1 << k) | (1 << g) | (1 << l) | (1 << m);
                        }
                    }
                }
            }
        }
    }
    return (sets[q] == h);
}

Compilation message

encoder.cpp: In function 'int encode(int, int, int)':
encoder.cpp:3:5: error: 'vector' was not declared in this scope
    3 |     vector<int> sets(921, 0);
      |     ^~~~~~
encoder.cpp:3:5: note: suggested alternatives:
In file included from /usr/include/c++/9/vector:67,
                 from /usr/include/c++/9/functional:62,
                 from /usr/include/c++/9/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/9/algorithm:71,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
                 from encoder.cpp:1:
/usr/include/c++/9/bits/stl_vector.h:386:11: note:   'std::vector'
  386 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
In file included from /usr/include/c++/9/functional:62,
                 from /usr/include/c++/9/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/9/algorithm:71,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
                 from encoder.cpp:1:
/usr/include/c++/9/vector:90:13: note:   'std::pmr::vector'
   90 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
encoder.cpp:3:12: error: expected primary-expression before 'int'
    3 |     vector<int> sets(921, 0);
      |            ^~~
encoder.cpp:11:29: error: 'sets' was not declared in this scope; did you mean 'setns'?
   11 |                             sets[id++] = (1 << i) | (1 << j) | (1 << k) | (1 << g) | (1 << l) | (1 << m);
      |                             ^~~~
      |                             setns
encoder.cpp:18:12: error: 'sets' was not declared in this scope; did you mean 'setns'?
   18 |     return sets[x]&~sets[y];
      |            ^~~~
      |            setns

decoder.cpp: In function 'int decode(int, int, int)':
decoder.cpp:3:5: error: 'vector' was not declared in this scope
    3 |     vector<int> sets(921, 0);
      |     ^~~~~~
decoder.cpp:3:5: note: suggested alternatives:
In file included from /usr/include/c++/9/vector:67,
                 from /usr/include/c++/9/functional:62,
                 from /usr/include/c++/9/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/9/algorithm:71,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
                 from decoder.cpp:1:
/usr/include/c++/9/bits/stl_vector.h:386:11: note:   'std::vector'
  386 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
In file included from /usr/include/c++/9/functional:62,
                 from /usr/include/c++/9/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/9/algorithm:71,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
                 from decoder.cpp:1:
/usr/include/c++/9/vector:90:13: note:   'std::pmr::vector'
   90 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
decoder.cpp:3:12: error: expected primary-expression before 'int'
    3 |     vector<int> sets(921, 0);
      |            ^~~
decoder.cpp:11:29: error: 'sets' was not declared in this scope; did you mean 'setns'?
   11 |                             sets[id++] = (1 << i) | (1 << j) | (1 << k) | (1 << g) | (1 << l) | (1 << m);
      |                             ^~~~
      |                             setns
decoder.cpp:18:13: error: 'sets' was not declared in this scope; did you mean 'setns'?
   18 |     return (sets[q] == h);
      |             ^~~~
      |             setns