제출 #730472

#제출 시각아이디문제언어결과실행 시간메모리
730472hoainiemBali Sculptures (APIO15_sculpture)C++14
37 / 100
5 ms768 KiB
#include <bits/stdc++.h> #define fi first #define se second #define lc id<<1 #define rc id<<1^1 const long long inf = 1e18; using namespace std; typedef pair<int, int> pii; const long long mx = 1073741823; int n, l, r; long long a[2008], orr[2008][2008]; long long ans = 0; bitset<2008>f[2008]; bool check(int x){ f[0].reset(); f[0].set(0); for (int j = 1; j <= r; j++){ for (int i = 0; i <= n; i++) if (i < j) f[j].reset(i); else{ f[j].reset(i); for (int pos = 1; pos <= i && !f[j].test(i); pos++) if (!(x & orr[pos][i]) && f[j - 1].test(pos - 1)) f[j].set(i); } if (f[j].test(n) && j >= l) return true; } return false; } int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n >> l >> r; for (int i = 1; i <= n; i++) cin >> a[i]; for (int i = 1; i <= n; i++) for (int j = i; j <= n; j++) orr[i][j] = orr[i][j - 1] + a[j]; for (int i = 1 << 29; i > 0; i >>= 1) ans += i * check(ans + i); cout << (int)(mx ^ ans); 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...