제출 #1121266

#제출 시각아이디문제언어결과실행 시간메모리
1121266vjudge1Art Collections (BOI22_art)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "art.h" void solve(int n) { vector<int> a; for(int i=1 ; i <= n ; i++) a.push_back(i); int ls=publish(a); vector<int> ans(n); for(int i=1 ; i < n ; i++){ int x=a.back(); a.pop_back(); reverse(a.begin() , a.end()); a.push_back(x); reverse(a.begin() , a.end()); int nw=publish(a); int p=((ls-nw+n-1)/2); ans[p]=i; } ans.push_back(a[1]); answer(ans); }

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

art.cpp: In function 'void solve(int)':
art.cpp:4:5: error: 'vector' was not declared in this scope
    4 |     vector<int> a;
      |     ^~~~~~
art.cpp:4:5: note: suggested alternatives:
In file included from /usr/include/c++/10/vector:67,
                 from /usr/include/c++/10/functional:62,
                 from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 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 /usr/include/c++/10/functional:62,
                 from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 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:12: error: expected primary-expression before 'int'
    4 |     vector<int> a;
      |            ^~~
art.cpp:6:9: error: 'a' was not declared in this scope
    6 |         a.push_back(i);
      |         ^
art.cpp:8:20: error: 'a' was not declared in this scope
    8 |     int ls=publish(a);
      |                    ^
art.cpp:9:12: error: expected primary-expression before 'int'
    9 |     vector<int> ans(n);
      |            ^~~
art.cpp:14:9: error: 'reverse' was not declared in this scope; did you mean 'std::reverse'?
   14 |         reverse(a.begin() , a.end());
      |         ^~~~~~~
      |         std::reverse
In file included from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from art.cpp:1:
/usr/include/c++/10/pstl/glue_algorithm_defs.h:249:1: note: 'std::reverse' declared here
  249 | reverse(_ExecutionPolicy&& __exec, _BidirectionalIterator __first, _BidirectionalIterator __last);
      | ^~~~~~~
art.cpp:20:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   20 |         ans[p]=i;
      |         ^~~
      |         abs
art.cpp:22:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
   22 |     ans.push_back(a[1]);
      |     ^~~
      |     abs
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) {
      |        ~~~~~~~~~^~~~