이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |