답안 #882462

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
882462 2023-12-03T08:24:27 Z vjudge1 Bali Sculptures (APIO15_sculpture) C++17
컴파일 오류
0 ms 0 KB
#pragma GCC optimize("O3", "unroll-loops")
#pragma GCC target("avx2", "popcnt")
#pragma optimize("Bismillahirrahmanirrahim")
//█▀█─█──█──█▀█─█─█
//█▄█─█──█──█▄█─█■█
//█─█─█▄─█▄─█─█─█─█
//Allahuekber
//ahmet23 orz...
//Sani buyuk Osman Pasa Plevneden cikmam diyor.
//FatihSultanMehmedHan
//YavuzSultanSelimHan
//AbdulhamidHan
#define author tolbi
#include <bits/stdc++.h>
using namespace std;
template<typename X, typename Y> istream& operator>>(istream& in, pair<X,Y> &pr) {return in>>pr.first>>pr.second;}
template<typename X, typename Y> ostream& operator<<(ostream& os, pair<X,Y> pr) {return os<<pr.first<<" "<<pr.second;}
template<typename X> istream& operator>>(istream& in, vector<X> &arr) {for(auto &it : arr) in>>it; return in;}
template<typename X> ostream& operator<<(ostream& os, vector<X> arr) {for(auto &it : arr) os<<it<<" "; return os;}
template<typename X, size_t Y> istream& operator>>(istream& in, array<X,Y> &arr) {for(auto &it : arr) in>>it; return in;}
template<typename X, size_t Y> ostream& operator<<(ostream& os, array<X,Y> arr) {for(auto &it : arr) os<<it<<" "; return os;}
#define int long long
#define endl '\n'
#define vint(x) vector<int> x
#define deci(x) int x;cin>>x;
#define decstr(x) string x;cin>>x;
#define cinarr(x) for (auto &it : x) cin>>it;
#define coutarr(x) for (auto &it : x) cout<<it<<" ";cout<<endl;
#define sortarr(x) sort(x.begin(),x.end())
#define sortrarr(x) sort(x.rbegin(),x.rend())
#define det(x) cout<<"NO\0YES"+x*3<<endl;
#define INF LONG_LONG_MAX
#define rev(x) reverse(x.begin(),x.end());
#define ios ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define tol(bi) (1LL<<((int)(bi)))
const int MOD = 1e9+7;
mt19937 ayahya(chrono::high_resolution_clock().now().time_since_epoch().count());
int32_t main(){
	ios;
	int t=1;
	int tno = 0;
	if (!t) cin>>t;
	while (t-(tno++)){
		deci(n);deci(a);deci(b);
		vint(arr(n));
		cinarr(arr);
		vector<int> pref = arr;
		for (int i = 1; i < n; i++){
			pref[i]+=pref[i-1];
		}
		function<int(int,int)> query = [&](int l, int r)->int{
			int hh = 0;
			if (l) hh = pref[l-1];
			return pref[r]-hh;
		};
		int rans = 0;
		int ans = 0;
		vector<vector<bool>> vis(n+1,vector<bool>(n+1,false));
		vector<vector<bitset<2001>>> dp(n+1,vector<bitset<2001>>(n+1));
		function<void(int,int)> f = [&](int l, int r)->void{
			if (r>=n){
				if (l==r){
					for (int i = a; i <= b; i++) dp[i]=1;
				}
				return;
			}
			if (vis[l][r]) return;
			vis[l][r]=true;
			f(l,r+1);
			swap(dp[l][r],dp[l][r+1]);
			if (!(query(l,r)&rans)){
				f(r+1,r+1);
				dp[l][r]|=dp[r+1][r+1]>>1;
			}
		};
		int LOG = 60;
		for (int bit = LOG-1; bit >= 0; bit--){
			for (int i = 0; i <= n; ++i)
			{
				for (int j = 0; j <= n; ++j){
					vis[i][j]=false;
				}
			}
			ans+=tol(bit);
			rans+=tol(bit);
			f(0,0);
			if (dp[0][0][0]) ans-=tol(bit);
			else rans-=tol(bit);
		}
		cout<<ans<<endl;
	}
}

Compilation message

sculpture.cpp:3: warning: ignoring '#pragma optimize ' [-Wunknown-pragmas]
    3 | #pragma optimize("Bismillahirrahmanirrahim")
      | 
sculpture.cpp: In lambda function:
sculpture.cpp:63:41: error: no match for 'operator=' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::vector<std::bitset<2001> > >, std::vector<std::bitset<2001> > >::value_type' {aka 'std::vector<std::bitset<2001> >'} and 'int')
   63 |      for (int i = a; i <= b; i++) dp[i]=1;
      |                                         ^
In file included from /usr/include/c++/10/vector:72,
                 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 sculpture.cpp:14:
/usr/include/c++/10/bits/vector.tcc:198:5: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = std::bitset<2001>; _Alloc = std::allocator<std::bitset<2001> >]'
  198 |     vector<_Tp, _Alloc>::
      |     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/10/bits/vector.tcc:199:42: note:   no known conversion for argument 1 from 'int' to 'const std::vector<std::bitset<2001> >&'
  199 |     operator=(const vector<_Tp, _Alloc>& __x)
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
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 sculpture.cpp:14:
/usr/include/c++/10/bits/stl_vector.h:709:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = std::bitset<2001>; _Alloc = std::allocator<std::bitset<2001> >]'
  709 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |       ^~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:709:26: note:   no known conversion for argument 1 from 'int' to 'std::vector<std::bitset<2001> >&&'
  709 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |                 ~~~~~~~~~^~~
/usr/include/c++/10/bits/stl_vector.h:730:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = std::bitset<2001>; _Alloc = std::allocator<std::bitset<2001> >]'
  730 |       operator=(initializer_list<value_type> __l)
      |       ^~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:730:46: note:   no known conversion for argument 1 from 'int' to 'std::initializer_list<std::bitset<2001> >'
  730 |       operator=(initializer_list<value_type> __l)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~