#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF = (int) 1e9 + 123;
const ll LINF = (ll) 1e18 + 123;
#define rep(i, s, t) for (auto i = (s); i < (t); ++(i))
#define per(i, s, t) for (auto i = (s); i >= (t); --(i))
#define sz(x) ((int) (x).size())
#define mp make_pair
#define pb push_back
bool mini(auto &x, const auto &y) {
if (y < x) {
x = y;
return 1;
}
return 0;
}
bool maxi(auto &x, const auto &y) {
if (y < x) {
x = y;
return 1;
}
return 0;
}
void run();
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
run();
return 0;
}
const int N = 2005;
const int L = 42;
int n, a, b;
ll x[N], p[N];
ll get(int l, int r) {
return p[r] - (l == 0 ? 0 : p[l - 1]);
}
namespace SmallN {
const int SN = 105;
bool dp[SN][SN];
void solve() {
ll ans = 0;
ll deny = 0;
per(bit, L, 0) {
memset(dp, 0, sizeof dp);
dp[0][0] = 1;
deny |= (1LL << bit);
rep(i, 0, n) {
rep(cnt, 0, b) {
if (!dp[i][cnt]) continue;
rep(j, i, n) {
ll s = get(i, j);
if (s & deny) continue;
dp[j + 1][cnt + 1] = 1;
}
}
}
bool ok = 0;
rep(i, a, b + 1) ok |= dp[n][i];
if (!ok) {
deny ^= (1LL << bit);
ans |= (1LL << bit);
}
}
cout << ans << "\n";
}
};
namespace LastGroup {
void solve() {
assert(0);
}
};
void run() {
cin >> n >> a >> b;
rep(i, 0, n) {
cin >> x[i];
}
partial_sum(x, x + n, p);
if (n <= 100) {
SmallN::solve();
} else {
LastGroup::solve();
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
2216 KB |
Output is correct |
2 |
Correct |
0 ms |
2216 KB |
Output is correct |
3 |
Correct |
0 ms |
2216 KB |
Output is correct |
4 |
Correct |
0 ms |
2216 KB |
Output is correct |
5 |
Correct |
0 ms |
2216 KB |
Output is correct |
6 |
Correct |
0 ms |
2216 KB |
Output is correct |
7 |
Correct |
0 ms |
2216 KB |
Output is correct |
8 |
Correct |
0 ms |
2216 KB |
Output is correct |
9 |
Correct |
0 ms |
2216 KB |
Output is correct |
10 |
Correct |
0 ms |
2216 KB |
Output is correct |
11 |
Correct |
0 ms |
2216 KB |
Output is correct |
12 |
Correct |
0 ms |
2216 KB |
Output is correct |
13 |
Correct |
0 ms |
2216 KB |
Output is correct |
14 |
Correct |
0 ms |
2216 KB |
Output is correct |
15 |
Correct |
0 ms |
2216 KB |
Output is correct |
16 |
Correct |
0 ms |
2216 KB |
Output is correct |
17 |
Correct |
0 ms |
2216 KB |
Output is correct |
18 |
Correct |
0 ms |
2216 KB |
Output is correct |
19 |
Correct |
0 ms |
2216 KB |
Output is correct |
20 |
Correct |
0 ms |
2216 KB |
Output is correct |
21 |
Correct |
0 ms |
2216 KB |
Output is correct |
22 |
Correct |
0 ms |
2216 KB |
Output is correct |
23 |
Correct |
0 ms |
2216 KB |
Output is correct |
24 |
Correct |
0 ms |
2216 KB |
Output is correct |
25 |
Correct |
0 ms |
2216 KB |
Output is correct |
26 |
Correct |
0 ms |
2216 KB |
Output is correct |
27 |
Correct |
0 ms |
2216 KB |
Output is correct |
28 |
Correct |
0 ms |
2216 KB |
Output is correct |
29 |
Correct |
0 ms |
2216 KB |
Output is correct |
30 |
Correct |
0 ms |
2216 KB |
Output is correct |
31 |
Correct |
0 ms |
2216 KB |
Output is correct |
32 |
Correct |
0 ms |
2216 KB |
Output is correct |
33 |
Correct |
0 ms |
2216 KB |
Output is correct |
34 |
Correct |
0 ms |
2216 KB |
Output is correct |
35 |
Correct |
0 ms |
2216 KB |
Output is correct |
36 |
Correct |
0 ms |
2216 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
2216 KB |
Output is correct |
2 |
Correct |
0 ms |
2216 KB |
Output is correct |
3 |
Correct |
0 ms |
2216 KB |
Output is correct |
4 |
Correct |
0 ms |
2216 KB |
Output is correct |
5 |
Correct |
0 ms |
2216 KB |
Output is correct |
6 |
Correct |
0 ms |
2216 KB |
Output is correct |
7 |
Correct |
0 ms |
2216 KB |
Output is correct |
8 |
Correct |
0 ms |
2216 KB |
Output is correct |
9 |
Correct |
0 ms |
2216 KB |
Output is correct |
10 |
Correct |
0 ms |
2216 KB |
Output is correct |
11 |
Correct |
0 ms |
2216 KB |
Output is correct |
12 |
Correct |
0 ms |
2216 KB |
Output is correct |
13 |
Correct |
0 ms |
2216 KB |
Output is correct |
14 |
Correct |
0 ms |
2216 KB |
Output is correct |
15 |
Correct |
0 ms |
2216 KB |
Output is correct |
16 |
Correct |
0 ms |
2216 KB |
Output is correct |
17 |
Correct |
0 ms |
2216 KB |
Output is correct |
18 |
Correct |
0 ms |
2216 KB |
Output is correct |
19 |
Correct |
0 ms |
2216 KB |
Output is correct |
20 |
Correct |
0 ms |
2216 KB |
Output is correct |
21 |
Correct |
0 ms |
2216 KB |
Output is correct |
22 |
Correct |
0 ms |
2216 KB |
Output is correct |
23 |
Correct |
0 ms |
2216 KB |
Output is correct |
24 |
Correct |
0 ms |
2216 KB |
Output is correct |
25 |
Correct |
0 ms |
2216 KB |
Output is correct |
26 |
Correct |
0 ms |
2216 KB |
Output is correct |
27 |
Correct |
0 ms |
2216 KB |
Output is correct |
28 |
Correct |
0 ms |
2216 KB |
Output is correct |
29 |
Correct |
0 ms |
2216 KB |
Output is correct |
30 |
Correct |
0 ms |
2216 KB |
Output is correct |
31 |
Correct |
0 ms |
2216 KB |
Output is correct |
32 |
Correct |
0 ms |
2216 KB |
Output is correct |
33 |
Correct |
0 ms |
2216 KB |
Output is correct |
34 |
Correct |
0 ms |
2216 KB |
Output is correct |
35 |
Correct |
0 ms |
2216 KB |
Output is correct |
36 |
Correct |
0 ms |
2216 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
2216 KB |
Output is correct |
2 |
Correct |
0 ms |
2216 KB |
Output is correct |
3 |
Correct |
0 ms |
2216 KB |
Output is correct |
4 |
Correct |
0 ms |
2216 KB |
Output is correct |
5 |
Correct |
0 ms |
2216 KB |
Output is correct |
6 |
Correct |
0 ms |
2216 KB |
Output is correct |
7 |
Correct |
0 ms |
2216 KB |
Output is correct |
8 |
Correct |
0 ms |
2216 KB |
Output is correct |
9 |
Correct |
0 ms |
2216 KB |
Output is correct |
10 |
Correct |
0 ms |
2216 KB |
Output is correct |
11 |
Correct |
0 ms |
2216 KB |
Output is correct |
12 |
Correct |
0 ms |
2216 KB |
Output is correct |
13 |
Correct |
0 ms |
2216 KB |
Output is correct |
14 |
Correct |
0 ms |
2216 KB |
Output is correct |
15 |
Correct |
0 ms |
2216 KB |
Output is correct |
16 |
Correct |
0 ms |
2216 KB |
Output is correct |
17 |
Correct |
0 ms |
2216 KB |
Output is correct |
18 |
Correct |
0 ms |
2216 KB |
Output is correct |
19 |
Correct |
0 ms |
2216 KB |
Output is correct |
20 |
Correct |
0 ms |
2216 KB |
Output is correct |
21 |
Correct |
0 ms |
2216 KB |
Output is correct |
22 |
Correct |
0 ms |
2216 KB |
Output is correct |
23 |
Correct |
0 ms |
2216 KB |
Output is correct |
24 |
Correct |
0 ms |
2216 KB |
Output is correct |
25 |
Correct |
0 ms |
2216 KB |
Output is correct |
26 |
Correct |
3 ms |
2216 KB |
Output is correct |
27 |
Correct |
9 ms |
2216 KB |
Output is correct |
28 |
Correct |
13 ms |
2216 KB |
Output is correct |
29 |
Correct |
13 ms |
2216 KB |
Output is correct |
30 |
Correct |
0 ms |
2216 KB |
Output is correct |
31 |
Correct |
13 ms |
2216 KB |
Output is correct |
32 |
Correct |
13 ms |
2216 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
2216 KB |
Output is correct |
2 |
Correct |
0 ms |
2216 KB |
Output is correct |
3 |
Correct |
0 ms |
2216 KB |
Output is correct |
4 |
Correct |
0 ms |
2216 KB |
Output is correct |
5 |
Correct |
0 ms |
2216 KB |
Output is correct |
6 |
Correct |
0 ms |
2216 KB |
Output is correct |
7 |
Correct |
0 ms |
2216 KB |
Output is correct |
8 |
Correct |
0 ms |
2216 KB |
Output is correct |
9 |
Correct |
0 ms |
2216 KB |
Output is correct |
10 |
Correct |
0 ms |
2216 KB |
Output is correct |
11 |
Correct |
0 ms |
2216 KB |
Output is correct |
12 |
Correct |
0 ms |
2216 KB |
Output is correct |
13 |
Correct |
0 ms |
2216 KB |
Output is correct |
14 |
Correct |
0 ms |
2216 KB |
Output is correct |
15 |
Correct |
0 ms |
2216 KB |
Output is correct |
16 |
Correct |
0 ms |
2216 KB |
Output is correct |
17 |
Correct |
0 ms |
2216 KB |
Output is correct |
18 |
Correct |
0 ms |
2216 KB |
Output is correct |
19 |
Correct |
0 ms |
2216 KB |
Output is correct |
20 |
Correct |
0 ms |
2216 KB |
Output is correct |
21 |
Correct |
0 ms |
2216 KB |
Output is correct |
22 |
Correct |
0 ms |
2216 KB |
Output is correct |
23 |
Correct |
0 ms |
2216 KB |
Output is correct |
24 |
Correct |
0 ms |
2216 KB |
Output is correct |
25 |
Correct |
0 ms |
2216 KB |
Output is correct |
26 |
Correct |
0 ms |
2216 KB |
Output is correct |
27 |
Correct |
0 ms |
2216 KB |
Output is correct |
28 |
Correct |
0 ms |
2216 KB |
Output is correct |
29 |
Correct |
0 ms |
2216 KB |
Output is correct |
30 |
Correct |
0 ms |
2216 KB |
Output is correct |
31 |
Correct |
0 ms |
2216 KB |
Output is correct |
32 |
Correct |
0 ms |
2216 KB |
Output is correct |
33 |
Correct |
0 ms |
2216 KB |
Output is correct |
34 |
Correct |
0 ms |
2216 KB |
Output is correct |
35 |
Correct |
0 ms |
2216 KB |
Output is correct |
36 |
Correct |
0 ms |
2216 KB |
Output is correct |
37 |
Correct |
0 ms |
2216 KB |
Output is correct |
38 |
Correct |
0 ms |
2216 KB |
Output is correct |
39 |
Correct |
0 ms |
2216 KB |
Output is correct |
40 |
Correct |
0 ms |
2216 KB |
Output is correct |
41 |
Correct |
0 ms |
2216 KB |
Output is correct |
42 |
Correct |
0 ms |
2216 KB |
Output is correct |
43 |
Correct |
0 ms |
2216 KB |
Output is correct |
44 |
Correct |
0 ms |
2216 KB |
Output is correct |
45 |
Correct |
0 ms |
2216 KB |
Output is correct |
46 |
Correct |
0 ms |
2216 KB |
Output is correct |
47 |
Correct |
0 ms |
2216 KB |
Output is correct |
48 |
Correct |
0 ms |
2216 KB |
Output is correct |
49 |
Correct |
6 ms |
2216 KB |
Output is correct |
50 |
Correct |
19 ms |
2216 KB |
Output is correct |
51 |
Correct |
19 ms |
2216 KB |
Output is correct |
52 |
Correct |
16 ms |
2216 KB |
Output is correct |
53 |
Correct |
0 ms |
2216 KB |
Output is correct |
54 |
Correct |
13 ms |
2216 KB |
Output is correct |
55 |
Correct |
13 ms |
2216 KB |
Output is correct |
56 |
Correct |
0 ms |
2216 KB |
Output is correct |
57 |
Correct |
3 ms |
2216 KB |
Output is correct |
58 |
Correct |
3 ms |
2216 KB |
Output is correct |
59 |
Correct |
3 ms |
2216 KB |
Output is correct |
60 |
Correct |
3 ms |
2216 KB |
Output is correct |
61 |
Correct |
0 ms |
2216 KB |
Output is correct |
62 |
Correct |
9 ms |
2216 KB |
Output is correct |
63 |
Correct |
6 ms |
2216 KB |
Output is correct |
64 |
Correct |
13 ms |
2216 KB |
Output is correct |
65 |
Correct |
0 ms |
2216 KB |
Output is correct |
66 |
Correct |
0 ms |
2216 KB |
Output is correct |
67 |
Correct |
0 ms |
2216 KB |
Output is correct |
68 |
Correct |
3 ms |
2216 KB |
Output is correct |
69 |
Correct |
6 ms |
2216 KB |
Output is correct |
70 |
Correct |
3 ms |
2216 KB |
Output is correct |
71 |
Correct |
0 ms |
2216 KB |
Output is correct |
72 |
Correct |
6 ms |
2216 KB |
Output is correct |
73 |
Correct |
6 ms |
2216 KB |
Output is correct |
74 |
Correct |
6 ms |
2216 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
2216 KB |
Output is correct |
2 |
Correct |
0 ms |
2216 KB |
Output is correct |
3 |
Correct |
0 ms |
2216 KB |
Output is correct |
4 |
Correct |
0 ms |
2216 KB |
Output is correct |
5 |
Correct |
0 ms |
2216 KB |
Output is correct |
6 |
Correct |
0 ms |
2216 KB |
Output is correct |
7 |
Correct |
0 ms |
2216 KB |
Output is correct |
8 |
Correct |
0 ms |
2216 KB |
Output is correct |
9 |
Correct |
0 ms |
2216 KB |
Output is correct |
10 |
Correct |
0 ms |
2216 KB |
Output is correct |
11 |
Correct |
0 ms |
2216 KB |
Output is correct |
12 |
Correct |
0 ms |
2216 KB |
Output is correct |
13 |
Correct |
0 ms |
2216 KB |
Output is correct |
14 |
Correct |
0 ms |
2216 KB |
Output is correct |
15 |
Correct |
0 ms |
2216 KB |
Output is correct |
16 |
Correct |
0 ms |
2216 KB |
Output is correct |
17 |
Correct |
0 ms |
2216 KB |
Output is correct |
18 |
Correct |
0 ms |
2216 KB |
Output is correct |
19 |
Correct |
0 ms |
2216 KB |
Output is correct |
20 |
Correct |
0 ms |
2216 KB |
Output is correct |
21 |
Correct |
0 ms |
2216 KB |
Output is correct |
22 |
Correct |
0 ms |
2216 KB |
Output is correct |
23 |
Correct |
0 ms |
2216 KB |
Output is correct |
24 |
Correct |
0 ms |
2216 KB |
Output is correct |
25 |
Correct |
0 ms |
2216 KB |
Output is correct |
26 |
Correct |
0 ms |
2216 KB |
Output is correct |
27 |
Correct |
0 ms |
2216 KB |
Output is correct |
28 |
Correct |
0 ms |
2216 KB |
Output is correct |
29 |
Correct |
0 ms |
2216 KB |
Output is correct |
30 |
Correct |
0 ms |
2216 KB |
Output is correct |
31 |
Correct |
0 ms |
2216 KB |
Output is correct |
32 |
Correct |
0 ms |
2216 KB |
Output is correct |
33 |
Correct |
0 ms |
2216 KB |
Output is correct |
34 |
Correct |
3 ms |
2216 KB |
Output is correct |
35 |
Correct |
0 ms |
2216 KB |
Output is correct |
36 |
Correct |
6 ms |
2216 KB |
Output is correct |
37 |
Correct |
9 ms |
2216 KB |
Output is correct |
38 |
Correct |
26 ms |
2216 KB |
Output is correct |
39 |
Correct |
16 ms |
2216 KB |
Output is correct |
40 |
Correct |
0 ms |
2216 KB |
Output is correct |
41 |
Correct |
13 ms |
2216 KB |
Output is correct |
42 |
Correct |
16 ms |
2216 KB |
Output is correct |
43 |
Correct |
0 ms |
2216 KB |
Output is correct |
44 |
Correct |
3 ms |
2216 KB |
Output is correct |
45 |
Correct |
3 ms |
2216 KB |
Output is correct |
46 |
Correct |
3 ms |
2216 KB |
Output is correct |
47 |
Correct |
3 ms |
2216 KB |
Output is correct |
48 |
Correct |
0 ms |
2216 KB |
Output is correct |
49 |
Correct |
6 ms |
2216 KB |
Output is correct |
50 |
Correct |
6 ms |
2216 KB |
Output is correct |
51 |
Runtime error |
0 ms |
2220 KB |
Execution killed because of forbidden syscall gettid (186) |
52 |
Halted |
0 ms |
0 KB |
- |