제출 #1120868

#제출 시각아이디문제언어결과실행 시간메모리
1120868vjudge1Art Collections (BOI22_art)C++17
컴파일 에러
0 ms0 KiB
// Bolatulu #include <bits/stdc++.h> #include "art.h" /* #pragma GCC target ("avx2") #pragma GCC optimization ("O3") #pragma GCC optimization ("unroll-loops") */ typedef long long ll; typedef unsigned long long ull; typedef double db; #define pb push_back #define eb emplace_back #define ins insert #define F first #define S second #define md (tl+tr)/2 #define TL v+v,tl,md #define TR v+v+1,md+1,tr #define Tl t[v].l,tl,md #define Tr t[v].r,md+1,tr #define all(x) (x).begin(),(x).end() #define yes cout << "YES\n" #define no cout << "NO\n" // #define int long long #define file(s) freopen(s".in", "r", stdin); freopen(s".out", "w", stdout); #define ld long double using namespace std; int binpow(int a,int n,int M) { if (n==0) return 1; if (n%2!=0) return (a * binpow(a,n-1,M))%M; int z=binpow(a,n/2,M); return (z*z)%M; } const ll INF = 1e18+7; const int N = 5e3+7; const int M = 1e4+7; const ld eps = 1e-3; int n; vector <int> v; int check(int i,bool b) { vector <int> d=v; int x=d[i]; d.erase(i); if (b) d.pb(x); else d.insert(d.begin(),x); return publish(d); } void solve(int nn) { n=nn; for (int i=1;i<=n;i++) v.pb(i); int s=publish(v); vector <int> ans; for (int i=1;i<=n;i++) { int z,y,l=0; if (i<n) { z=check(i,true)-s; y=n-i; l+=(y-z)/2; } if (i>1) { z=s-check(i,false); y=i-1; l+=(y-z)/2; } ans.pb(l+1); } answer(ans); } /* signed main() { //file("jenga"); ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr); int test = 1; // cin >> test; while (test--) { solve(); if (test) cout << '\n'; } return 0; } */

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

art.cpp: In function 'int check(int, bool)':
art.cpp:52:14: error: no matching function for call to 'std::vector<int>::erase(int&)'
   52 |     d.erase(i);
      |              ^
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:2:
/usr/include/c++/10/bits/stl_vector.h:1430:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(std::vector<_Tp, _Alloc>::const_iterator) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::iterator = std::vector<int>::iterator; std::vector<_Tp, _Alloc>::const_iterator = std::vector<int>::const_iterator]'
 1430 |       erase(const_iterator __position)
      |       ^~~~~
/usr/include/c++/10/bits/stl_vector.h:1430:28: note:   no known conversion for argument 1 from 'int' to 'std::vector<int>::const_iterator'
 1430 |       erase(const_iterator __position)
      |             ~~~~~~~~~~~~~~~^~~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1457:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(std::vector<_Tp, _Alloc>::const_iterator, std::vector<_Tp, _Alloc>::const_iterator) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::iterator = std::vector<int>::iterator; std::vector<_Tp, _Alloc>::const_iterator = std::vector<int>::const_iterator]'
 1457 |       erase(const_iterator __first, const_iterator __last)
      |       ^~~~~
/usr/include/c++/10/bits/stl_vector.h:1457:7: note:   candidate expects 2 arguments, 1 provided
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) {
      |        ~~~~~~~~~^~~~