#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef pair<ii, int> ri3;
#define mp make_pair
#define pb push_back
#define fi first
#define sc second
#define SZ(x) (int)(x).size()
#define ALL(x) begin(x), end(x)
#define REP(i, n) for (int i = 0; i < n; ++i)
#define FOR(i, a, b) for (int i = a; i <= b; ++i)
#define RFOR(i, a, b) for (int i = a; i >= b; --i)
const int INF = 1e9;
int main() {
//freopen("in.txt", "r", stdin);
ios::sync_with_stdio(false);
cin.tie(0);
int n, a, b; cin >> n >> a >> b;
int x[n+1], p[n+1]; p[0] = 0;
for (int i = 1; i <= n; ++i) {
cin >> x[i];
p[i] = p[i-1] + x[i];
}
// ll ans = 0, mask = 0;
// if (a == 1) {
// for (int k = 41; k >= 0; --k) {
// mask |= (1LL<<k);
// int dp[n+2]; dp[n+1] = 0;
// for (int i = n; i >= 1; --i) {
// dp[i] = INF;
// for (int j = i; j <= n; ++j) {
// ll sum = p[j] - p[i-1];
// if ((mask&sum) == 0) dp[i] = min(dp[i], dp[j+1]+1);
// }
// }
// //cout << k << " :: " << ans << " " << dp[1] << endl;
// if (dp[1] > b) ans |= 1LL<<k, mask &= ~(1LL<<k);
// //if (dp[1] > b) cout << "BAD BIT " << k << endl;
// }
// }
// else {
// for (int k = 41; k >= 0; --k) {
// mask |= (1LL<<k);
// bool dp[n+2][b+1]; memset(dp[n+1], 1, sizeof dp[n+1]);
//
// for (int i = n; i >= 1; --i) {
// for (int x = 0; x <= b; ++x) {
// dp[i][x] = 0;
// if (x) for (int j = i; j <= n; ++j) {
// ll sum = p[j] - p[i-1];
// if ((mask&sum) == 0) dp[i][x] |= dp[j+1][x-1];
// }
// }
// }
//
// bool ok = false;
// for (int x = a; x <= b; ++x) if (dp[1][x]) {
// ok = true;
// break;
// }
// //cout << k << " :: " << ans << endl;
// //cout << '\t'; for (int i = a; i <= b; ++i) cout << dp[1][i] << ' '; cout << endl;
// if (!ok) ans |= 1LL<<k, mask &= ~(1LL<<k);
// //if (!ok) cout << "BAD BIT " << k << endl;
// }
// }
//cout << ans << '\n';
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
444 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |