제출 #1121218

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

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

art.cpp: In function 'void solve(int)':
art.cpp:11:20: error: could not convert 'a' from 'std::deque<int>' to 'std::vector<int>'
   11 |     int ls=publish(a);
      |                    ^
      |                    |
      |                    std::deque<int>
art.cpp:16:17: error: 'all' was not declared in this scope; did you mean 'std::filesystem::perms::all'?
   16 |         reverse(all(x));
      |                 ^~~
      |                 std::filesystem::perms::all
In file included from /usr/include/c++/10/filesystem:44,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:129,
                 from art.cpp:1:
/usr/include/c++/10/bits/fs_fwd.h:148:7: note: 'std::filesystem::perms::all' declared here
  148 |       all  =  0777,
      |       ^~~
art.cpp:17:11: error: 'class std::deque<int>' has no member named 'pb'
   17 |         a.pb(x);
      |           ^~
art.cpp:19:24: error: could not convert 'a' from 'std::deque<int>' to 'std::vector<int>'
   19 |         int nw=publish(a);
      |                        ^
      |                        |
      |                        std::deque<int>
art.cpp:21:13: error: 'class std::vector<int>' has no member named 'pb'
   21 |         ans.pb((ls-nw+n-1)/2);
      |             ^~
art.cpp:23:9: error: 'class std::vector<int>' has no member named 'pb'
   23 |     ans.pb(a[0]);
      |         ^~
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) {
      |        ~~~~~~~~~^~~~