# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
846102 | 2023-09-07T09:54:48 Z | vjudge1 | Bali Sculptures (APIO15_sculpture) | C++17 | 63 ms | 756 KB |
#include <bits/stdc++.h> #define ll long long #define ld long double #define eb emplace_back #define task "" #define fast ios::sync_with_stdio(0),cin.tie(0),cout.tie(0); #define nx freopen (task".inp","r",stdin), freopen (task".out","w",stdout); #define fi first #define se second #define pii pair <int, int> #define tii tuple <int, int, int> #define bit(mask, i) ((mask) >> (i) & 1) using namespace std; const int nmax = 2002; int n, a, b; ll pref[nmax]; bool dp[102][102]; ll sum(int i, int j) { return pref[j] - pref[i - 1]; } void sub1234() { ll res = 137438953471; for (int k = 36; k >= 0; --k) { memset(dp, 0, sizeof dp); dp[0][0] = 1; res ^= (1LL << k); for (int i = 1; i <= n; ++i) for (int group = 1; group <= b; ++group) for (int j = 1; j <= i; ++j) if ((sum(j, i) & res) == sum(j, i)) dp[i][group] |= dp[j - 1][group - 1]; bool ok = 0; for (int group = a; group <= b; ++group) ok |= (dp[n][group]); if (!ok) res ^= (1LL << k); } cout << res; } ll dp5[nmax]; void sub5() { ll res = (1LL << 41) - 1; for (int k = 40; k >= 0; --k) { res ^= (1LL << k); memset(dp5, 0x3f, sizeof dp5); dp5[0] = 0; for (int i = 1; i <= n; ++i) { for (int j = 1; j <= i; ++j) { if ((sum(j, i) & res) == sum(j, i)) dp5[i] = min(dp5[i], dp5[j - 1] + 1); } } if (dp5[n] > b) res ^= (1LL << k); } cout << res; exit(0); } int main() { if (ifstream(task".inp")) nx fast cin >> n >> a >> b; for (int y, i = 1; i <= n; ++i) cin >> y, pref[i] = pref[i - 1] + y; if (a == 1) sub5(); sub1234(); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 344 KB | Output is correct |
3 | Correct | 0 ms | 344 KB | Output is correct |
4 | Correct | 1 ms | 344 KB | Output is correct |
5 | Correct | 1 ms | 348 KB | Output is correct |
6 | Correct | 1 ms | 344 KB | Output is correct |
7 | Correct | 0 ms | 348 KB | Output is correct |
8 | Correct | 0 ms | 348 KB | Output is correct |
9 | Correct | 1 ms | 348 KB | Output is correct |
10 | Correct | 1 ms | 344 KB | Output is correct |
11 | Correct | 0 ms | 344 KB | Output is correct |
12 | Correct | 0 ms | 344 KB | Output is correct |
13 | Correct | 0 ms | 600 KB | Output is correct |
14 | Correct | 0 ms | 348 KB | Output is correct |
15 | Correct | 0 ms | 348 KB | Output is correct |
16 | Correct | 0 ms | 344 KB | Output is correct |
17 | Correct | 1 ms | 348 KB | Output is correct |
18 | Correct | 1 ms | 344 KB | Output is correct |
19 | Correct | 0 ms | 344 KB | Output is correct |
20 | Correct | 0 ms | 344 KB | Output is correct |
21 | Correct | 0 ms | 344 KB | Output is correct |
22 | Correct | 1 ms | 756 KB | Output is correct |
23 | Correct | 0 ms | 348 KB | Output is correct |
24 | Correct | 0 ms | 348 KB | Output is correct |
25 | Correct | 0 ms | 344 KB | Output is correct |
26 | Correct | 1 ms | 600 KB | Output is correct |
27 | Correct | 0 ms | 344 KB | Output is correct |
28 | Correct | 1 ms | 344 KB | Output is correct |
29 | Correct | 1 ms | 600 KB | Output is correct |
30 | Correct | 1 ms | 344 KB | Output is correct |
31 | Correct | 0 ms | 344 KB | Output is correct |
32 | Correct | 0 ms | 344 KB | Output is correct |
33 | Correct | 0 ms | 600 KB | Output is correct |
34 | Correct | 0 ms | 344 KB | Output is correct |
35 | Correct | 0 ms | 344 KB | Output is correct |
36 | Correct | 1 ms | 348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 344 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 344 KB | Output is correct |
5 | Correct | 0 ms | 344 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Correct | 0 ms | 344 KB | Output is correct |
8 | Correct | 0 ms | 344 KB | Output is correct |
9 | Correct | 0 ms | 344 KB | Output is correct |
10 | Correct | 1 ms | 344 KB | Output is correct |
11 | Correct | 0 ms | 344 KB | Output is correct |
12 | Correct | 0 ms | 344 KB | Output is correct |
13 | Correct | 0 ms | 344 KB | Output is correct |
14 | Correct | 0 ms | 348 KB | Output is correct |
15 | Correct | 0 ms | 344 KB | Output is correct |
16 | Correct | 0 ms | 344 KB | Output is correct |
17 | Correct | 0 ms | 348 KB | Output is correct |
18 | Correct | 1 ms | 552 KB | Output is correct |
19 | Correct | 0 ms | 348 KB | Output is correct |
20 | Correct | 0 ms | 344 KB | Output is correct |
21 | Correct | 0 ms | 344 KB | Output is correct |
22 | Correct | 0 ms | 348 KB | Output is correct |
23 | Correct | 1 ms | 344 KB | Output is correct |
24 | Correct | 0 ms | 344 KB | Output is correct |
25 | Correct | 0 ms | 344 KB | Output is correct |
26 | Correct | 0 ms | 344 KB | Output is correct |
27 | Correct | 0 ms | 348 KB | Output is correct |
28 | Correct | 0 ms | 344 KB | Output is correct |
29 | Correct | 1 ms | 344 KB | Output is correct |
30 | Correct | 1 ms | 348 KB | Output is correct |
31 | Correct | 0 ms | 344 KB | Output is correct |
32 | Correct | 0 ms | 348 KB | Output is correct |
33 | Correct | 0 ms | 344 KB | Output is correct |
34 | Correct | 0 ms | 344 KB | Output is correct |
35 | Correct | 0 ms | 348 KB | Output is correct |
36 | Correct | 0 ms | 348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 344 KB | Output is correct |
3 | Correct | 0 ms | 344 KB | Output is correct |
4 | Correct | 0 ms | 344 KB | Output is correct |
5 | Correct | 0 ms | 344 KB | Output is correct |
6 | Correct | 0 ms | 344 KB | Output is correct |
7 | Correct | 0 ms | 344 KB | Output is correct |
8 | Correct | 0 ms | 344 KB | Output is correct |
9 | Correct | 0 ms | 344 KB | Output is correct |
10 | Correct | 0 ms | 344 KB | Output is correct |
11 | Correct | 0 ms | 344 KB | Output is correct |
12 | Correct | 0 ms | 348 KB | Output is correct |
13 | Correct | 1 ms | 344 KB | Output is correct |
14 | Correct | 0 ms | 344 KB | Output is correct |
15 | Correct | 0 ms | 348 KB | Output is correct |
16 | Correct | 1 ms | 344 KB | Output is correct |
17 | Correct | 0 ms | 344 KB | Output is correct |
18 | Correct | 0 ms | 348 KB | Output is correct |
19 | Correct | 0 ms | 344 KB | Output is correct |
20 | Correct | 0 ms | 348 KB | Output is correct |
21 | Correct | 0 ms | 344 KB | Output is correct |
22 | Correct | 0 ms | 344 KB | Output is correct |
23 | Correct | 0 ms | 348 KB | Output is correct |
24 | Correct | 0 ms | 344 KB | Output is correct |
25 | Correct | 0 ms | 348 KB | Output is correct |
26 | Correct | 1 ms | 344 KB | Output is correct |
27 | Correct | 0 ms | 344 KB | Output is correct |
28 | Correct | 1 ms | 344 KB | Output is correct |
29 | Correct | 1 ms | 344 KB | Output is correct |
30 | Correct | 1 ms | 344 KB | Output is correct |
31 | Correct | 1 ms | 344 KB | Output is correct |
32 | Correct | 1 ms | 344 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 344 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 344 KB | Output is correct |
7 | Correct | 0 ms | 344 KB | Output is correct |
8 | Correct | 0 ms | 344 KB | Output is correct |
9 | Correct | 0 ms | 344 KB | Output is correct |
10 | Correct | 0 ms | 344 KB | Output is correct |
11 | Correct | 0 ms | 344 KB | Output is correct |
12 | Correct | 0 ms | 600 KB | Output is correct |
13 | Correct | 0 ms | 600 KB | Output is correct |
14 | Correct | 0 ms | 344 KB | Output is correct |
15 | Correct | 0 ms | 348 KB | Output is correct |
16 | Correct | 0 ms | 344 KB | Output is correct |
17 | Correct | 0 ms | 344 KB | Output is correct |
18 | Correct | 1 ms | 348 KB | Output is correct |
19 | Correct | 0 ms | 344 KB | Output is correct |
20 | Correct | 0 ms | 348 KB | Output is correct |
21 | Correct | 0 ms | 348 KB | Output is correct |
22 | Correct | 0 ms | 344 KB | Output is correct |
23 | Correct | 0 ms | 344 KB | Output is correct |
24 | Correct | 0 ms | 344 KB | Output is correct |
25 | Correct | 0 ms | 344 KB | Output is correct |
26 | Correct | 0 ms | 344 KB | Output is correct |
27 | Correct | 1 ms | 344 KB | Output is correct |
28 | Correct | 0 ms | 344 KB | Output is correct |
29 | Correct | 0 ms | 344 KB | Output is correct |
30 | Correct | 0 ms | 344 KB | Output is correct |
31 | Correct | 1 ms | 344 KB | Output is correct |
32 | Correct | 0 ms | 344 KB | Output is correct |
33 | Correct | 0 ms | 344 KB | Output is correct |
34 | Correct | 0 ms | 348 KB | Output is correct |
35 | Correct | 0 ms | 344 KB | Output is correct |
36 | Correct | 0 ms | 344 KB | Output is correct |
37 | Correct | 0 ms | 344 KB | Output is correct |
38 | Correct | 0 ms | 600 KB | Output is correct |
39 | Correct | 0 ms | 344 KB | Output is correct |
40 | Correct | 0 ms | 344 KB | Output is correct |
41 | Correct | 0 ms | 344 KB | Output is correct |
42 | Correct | 0 ms | 344 KB | Output is correct |
43 | Correct | 0 ms | 344 KB | Output is correct |
44 | Correct | 0 ms | 344 KB | Output is correct |
45 | Correct | 0 ms | 344 KB | Output is correct |
46 | Correct | 1 ms | 344 KB | Output is correct |
47 | Correct | 1 ms | 344 KB | Output is correct |
48 | Correct | 0 ms | 344 KB | Output is correct |
49 | Correct | 0 ms | 344 KB | Output is correct |
50 | Correct | 1 ms | 344 KB | Output is correct |
51 | Correct | 1 ms | 344 KB | Output is correct |
52 | Correct | 1 ms | 344 KB | Output is correct |
53 | Correct | 1 ms | 344 KB | Output is correct |
54 | Correct | 1 ms | 344 KB | Output is correct |
55 | Correct | 1 ms | 344 KB | Output is correct |
56 | Correct | 0 ms | 348 KB | Output is correct |
57 | Correct | 0 ms | 344 KB | Output is correct |
58 | Correct | 0 ms | 344 KB | Output is correct |
59 | Correct | 1 ms | 344 KB | Output is correct |
60 | Correct | 1 ms | 344 KB | Output is correct |
61 | Correct | 1 ms | 344 KB | Output is correct |
62 | Correct | 1 ms | 344 KB | Output is correct |
63 | Correct | 1 ms | 344 KB | Output is correct |
64 | Correct | 21 ms | 344 KB | Output is correct |
65 | Correct | 1 ms | 348 KB | Output is correct |
66 | Correct | 1 ms | 348 KB | Output is correct |
67 | Correct | 3 ms | 344 KB | Output is correct |
68 | Correct | 8 ms | 344 KB | Output is correct |
69 | Correct | 16 ms | 344 KB | Output is correct |
70 | Correct | 15 ms | 348 KB | Output is correct |
71 | Correct | 1 ms | 344 KB | Output is correct |
72 | Correct | 18 ms | 344 KB | Output is correct |
73 | Correct | 13 ms | 344 KB | Output is correct |
74 | Correct | 12 ms | 480 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 344 KB | Output is correct |
3 | Correct | 0 ms | 344 KB | Output is correct |
4 | Correct | 0 ms | 344 KB | Output is correct |
5 | Correct | 0 ms | 344 KB | Output is correct |
6 | Correct | 0 ms | 344 KB | Output is correct |
7 | Correct | 0 ms | 344 KB | Output is correct |
8 | Correct | 0 ms | 600 KB | Output is correct |
9 | Correct | 1 ms | 344 KB | Output is correct |
10 | Correct | 0 ms | 344 KB | Output is correct |
11 | Correct | 0 ms | 344 KB | Output is correct |
12 | Correct | 0 ms | 348 KB | Output is correct |
13 | Correct | 1 ms | 344 KB | Output is correct |
14 | Correct | 0 ms | 344 KB | Output is correct |
15 | Correct | 1 ms | 344 KB | Output is correct |
16 | Correct | 0 ms | 348 KB | Output is correct |
17 | Correct | 0 ms | 344 KB | Output is correct |
18 | Correct | 0 ms | 344 KB | Output is correct |
19 | Correct | 0 ms | 344 KB | Output is correct |
20 | Correct | 0 ms | 348 KB | Output is correct |
21 | Correct | 0 ms | 344 KB | Output is correct |
22 | Correct | 0 ms | 344 KB | Output is correct |
23 | Correct | 0 ms | 344 KB | Output is correct |
24 | Correct | 0 ms | 348 KB | Output is correct |
25 | Correct | 0 ms | 344 KB | Output is correct |
26 | Correct | 0 ms | 348 KB | Output is correct |
27 | Correct | 0 ms | 348 KB | Output is correct |
28 | Correct | 0 ms | 344 KB | Output is correct |
29 | Correct | 1 ms | 348 KB | Output is correct |
30 | Correct | 0 ms | 344 KB | Output is correct |
31 | Correct | 0 ms | 348 KB | Output is correct |
32 | Correct | 0 ms | 344 KB | Output is correct |
33 | Correct | 0 ms | 344 KB | Output is correct |
34 | Correct | 0 ms | 344 KB | Output is correct |
35 | Correct | 0 ms | 344 KB | Output is correct |
36 | Correct | 0 ms | 344 KB | Output is correct |
37 | Correct | 1 ms | 344 KB | Output is correct |
38 | Correct | 1 ms | 344 KB | Output is correct |
39 | Correct | 1 ms | 344 KB | Output is correct |
40 | Correct | 1 ms | 344 KB | Output is correct |
41 | Correct | 1 ms | 344 KB | Output is correct |
42 | Correct | 1 ms | 344 KB | Output is correct |
43 | Correct | 0 ms | 344 KB | Output is correct |
44 | Correct | 1 ms | 344 KB | Output is correct |
45 | Correct | 1 ms | 344 KB | Output is correct |
46 | Correct | 0 ms | 348 KB | Output is correct |
47 | Correct | 1 ms | 344 KB | Output is correct |
48 | Correct | 1 ms | 344 KB | Output is correct |
49 | Correct | 1 ms | 600 KB | Output is correct |
50 | Correct | 1 ms | 348 KB | Output is correct |
51 | Correct | 1 ms | 344 KB | Output is correct |
52 | Correct | 5 ms | 344 KB | Output is correct |
53 | Correct | 9 ms | 344 KB | Output is correct |
54 | Correct | 18 ms | 344 KB | Output is correct |
55 | Correct | 16 ms | 344 KB | Output is correct |
56 | Correct | 55 ms | 468 KB | Output is correct |
57 | Correct | 55 ms | 344 KB | Output is correct |
58 | Correct | 54 ms | 472 KB | Output is correct |
59 | Correct | 63 ms | 472 KB | Output is correct |
60 | Correct | 58 ms | 344 KB | Output is correct |
61 | Correct | 1 ms | 348 KB | Output is correct |
62 | Correct | 8 ms | 348 KB | Output is correct |
63 | Correct | 16 ms | 344 KB | Output is correct |
64 | Correct | 14 ms | 344 KB | Output is correct |
65 | Correct | 27 ms | 344 KB | Output is correct |
66 | Correct | 41 ms | 344 KB | Output is correct |
67 | Correct | 63 ms | 472 KB | Output is correct |
68 | Correct | 58 ms | 344 KB | Output is correct |
69 | Correct | 54 ms | 472 KB | Output is correct |