제출 #1237747

#제출 시각아이디문제언어결과실행 시간메모리
1237747tin_leBali Sculptures (APIO15_sculpture)C++20
71 / 100
1095 ms616 KiB
#include<bits/stdc++.h> using namespace std; using ll = long long; using vi = vector<int>; using vll = vector<ll>; using vvll = vector<vll>; #define INF 1e18 const int B = 2005; bitset<B> dp[B]; void solve() { int n, l, r; cin >> n >> l >> r; vll a(n); for(auto& x : a) cin >> x; const int K = 40; ll cand = 0; for(int i = l; i <= r; i++) dp[i].set(n); auto f = [&](int b) -> bool { for(int i = n - 1; i >= 0; i--) { ll x = 0; bitset<B> now; for(int j = i; j < n; j++) { x += a[j]; if((cand >> b) == (cand | x) >> b) { now.set(j + 1); } } for(int g = 0; g < r; g++) { dp[g][i] = (dp[g + 1] & now).any(); } } return dp[0][0]; }; for(int b = K - 1; b >= 0; b--) { if(f(b)) continue; cand ^= 1LL << b; } cout << cand << '\n'; } signed main() { int t = 1; for(int i = 1; i <= t; i++) { solve(); } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...