이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
void just_do_it();
int main() {
#ifdef KAMIRULEZ
freopen("kamirulez.inp", "r", stdin);
freopen("kamirulez.out", "w", stdout);
#endif
ios_base::sync_with_stdio(0);
cin.tie(0);
just_do_it();
return 0;
}
const int maxN = 2e3 + 20;
int a[maxN];
bool can[maxN][maxN];
void just_do_it() {
int N, A, B;
cin >> N >> A >> B;
for (int i = 1; i <= N; i++) {
cin >> a[i];
}
long long pref = 0;
long long res = 0;
for (int b = 39; b >= 0; b--) {
pref |= (1LL << b);
for (int i = 0; i <= N; i++) {
for (int j = 0; j <= N; j++) {
can[i][j] = false;
}
}
can[0][0] = true;
for (int i = 1; i <= N; i++) {
for (int j = 1; j <= N; j++) {
long long S = 0;
for (int k = i; k >= 1; k--) {
S += a[k];
if (((S & pref) | res) == res) {
can[i][j] |= can[k - 1][j - 1];
}
}
}
}
bool ok = false;
for (int j = A; j <= B; j++) {
ok |= can[N][j];
}
if (!ok) {
res |= (1LL << b);
}
}
cout << res;
}
# | 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... |