답안 #713120

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
713120 2023-03-21T08:09:03 Z gun_gan Art Collections (BOI22_art) C++17
컴파일 오류
0 ms 0 KB
#include <art.h>

void solve(int n) {
      vector<int> ans(n);
      for(int i = 1; i <= n; i++) {
            vector<int> v;
            for(int j = 1; j <= n; j++) {
                  if(i != j) v.push_back(j);
            }
            v.push_back(i);
            int x = publish(v);
            ans[n - x - 1] = i;
      }
      answer(ans);
}

Compilation message

art.cpp: In function 'void solve(int)':
art.cpp:4:7: error: 'vector' was not declared in this scope
    4 |       vector<int> ans(n);
      |       ^~~~~~
art.cpp:4:7: note: suggested alternatives:
In file included from /usr/include/c++/10/vector:67,
                 from art.h:1,
                 from art.cpp:1:
/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 art.h:1,
                 from art.cpp:1:
/usr/include/c++/10/vector:86:13: note:   'std::pmr::vector'
   86 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
art.cpp:4:14: error: expected primary-expression before 'int'
    4 |       vector<int> ans(n);
      |              ^~~
art.cpp:6:20: error: expected primary-expression before 'int'
    6 |             vector<int> v;
      |                    ^~~
art.cpp:8:30: error: 'v' was not declared in this scope
    8 |                   if(i != j) v.push_back(j);
      |                              ^
art.cpp:10:13: error: 'v' was not declared in this scope
   10 |             v.push_back(i);
      |             ^
art.cpp:12:13: error: 'ans' was not declared in this scope
   12 |             ans[n - x - 1] = i;
      |             ^~~
art.cpp:14:14: error: 'ans' was not declared in this scope
   14 |       answer(ans);
      |              ^~~
interface.cpp: In function 'int publish(std::vector<int>)':
interface.cpp:20:17: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   20 |     if(v.size() != N) {
      |        ~~~~~~~~~^~~~
interface.cpp: In function 'void answer(std::vector<int>)':
interface.cpp:36:17: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   36 |     if(v.size() != N) {
      |        ~~~~~~~~~^~~~