답안 #882458

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
882458 2023-12-03T08:14:34 Z vjudge1 Bali Sculptures (APIO15_sculpture) C++17
0 / 100
1 ms 604 KB
#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,vector<bool>(n));
		vector<vector<bitset<2001>>> dp(n+1,vector<bitset<2001>>(n+1));
		for (int i = a; i <= b; i++){
			dp[n][n][i]=1;
		}
		function<void(int,int)> f = [&](int l, int r)->void{
			if (r>=n) return;
			if (vis[l][r]) return;
			vis[l][r]=true;
			f(l,r+1);
			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 = 45;
		for (int bit = LOG-1; bit >= 0; bit--){
			for (int i = 0; i <= n; ++i)
			{
				fill(vis[i].begin(), vis[i].end(),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:1: warning: ignoring '#pragma optimize ' [-Wunknown-pragmas]
    1 | #pragma optimize("Bismillahirrahmanirrahim")
      |
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Runtime error 1 ms 600 KB Execution killed with signal 11
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Runtime error 1 ms 348 KB Execution killed with signal 11
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Runtime error 1 ms 600 KB Execution killed with signal 11
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Runtime error 1 ms 348 KB Execution killed with signal 11
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Runtime error 1 ms 604 KB Execution killed with signal 11
4 Halted 0 ms 0 KB -