# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
78028 | 2018-10-02T00:15:34 Z | xiaowuc1 | Bali Sculptures (APIO15_sculpture) | C++14 | 1000 ms | 1672 KB |
#include <bits/stdc++.h> /* unsigned seed1 = std::chrono::system_clock::now().time_since_epoch().count(); mt19937 g1.seed(seed1); ios_base::sync_with_stdio(false); cin.tie(NULL); */ using namespace std; const double PI = 2 * acos(0); typedef long long ll; typedef unsigned long long ull; typedef pair<int, int> pii; typedef pair<int, ll> pill; typedef pair<ll, ll> pll; typedef long double ld; typedef vector<vector<ll>> matrix; ll pref[2001]; int n, lhs, rhs; bool valid[2001]; bool nextValid[2001]; bool can(ll mask) { memset(valid, 0, sizeof(valid)); valid[0] = true; for(int x = 1; x <= rhs; x++) { memset(nextValid, 0, sizeof(nextValid)); for(int a = 0; a <= n; a++) { if(!valid[a]) continue; for(int b = a+1; b <= n; b++) { ll vv = pref[b] - pref[a]; nextValid[b] |= (vv&mask)==vv; } } if(x >= lhs && nextValid[n]) return true; memcpy(valid, nextValid, sizeof(valid)); } return false; } int main() { scanf("%d%d%d", &n, &lhs, &rhs); for(int i = 0; i < n; i++) { scanf("%lld", &pref[i+1]); pref[i+1] += pref[i]; } ll ret = 1LL << 60; ret--; for(int i = 59; i >= 0; i--) { ll ans = ret ^ (1LL << (i)); if(can(ans)) { ret = ans; } } printf("%lld\n", ret); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 372 KB | Output is correct |
3 | Correct | 2 ms | 408 KB | Output is correct |
4 | Correct | 2 ms | 464 KB | Output is correct |
5 | Correct | 2 ms | 608 KB | Output is correct |
6 | Correct | 2 ms | 648 KB | Output is correct |
7 | Correct | 2 ms | 648 KB | Output is correct |
8 | Correct | 2 ms | 708 KB | Output is correct |
9 | Correct | 2 ms | 708 KB | Output is correct |
10 | Correct | 2 ms | 708 KB | Output is correct |
11 | Correct | 2 ms | 708 KB | Output is correct |
12 | Correct | 3 ms | 708 KB | Output is correct |
13 | Correct | 3 ms | 708 KB | Output is correct |
14 | Correct | 2 ms | 708 KB | Output is correct |
15 | Correct | 3 ms | 708 KB | Output is correct |
16 | Correct | 3 ms | 708 KB | Output is correct |
17 | Correct | 2 ms | 708 KB | Output is correct |
18 | Correct | 7 ms | 708 KB | Output is correct |
19 | Correct | 2 ms | 708 KB | Output is correct |
20 | Correct | 2 ms | 708 KB | Output is correct |
21 | Correct | 2 ms | 708 KB | Output is correct |
22 | Correct | 2 ms | 708 KB | Output is correct |
23 | Correct | 2 ms | 708 KB | Output is correct |
24 | Correct | 2 ms | 708 KB | Output is correct |
25 | Correct | 2 ms | 708 KB | Output is correct |
26 | Correct | 3 ms | 708 KB | Output is correct |
27 | Correct | 2 ms | 708 KB | Output is correct |
28 | Correct | 2 ms | 708 KB | Output is correct |
29 | Correct | 2 ms | 712 KB | Output is correct |
30 | Correct | 2 ms | 720 KB | Output is correct |
31 | Correct | 2 ms | 720 KB | Output is correct |
32 | Correct | 2 ms | 728 KB | Output is correct |
33 | Correct | 2 ms | 732 KB | Output is correct |
34 | Correct | 2 ms | 732 KB | Output is correct |
35 | Correct | 2 ms | 740 KB | Output is correct |
36 | Correct | 2 ms | 740 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 740 KB | Output is correct |
2 | Correct | 2 ms | 740 KB | Output is correct |
3 | Correct | 2 ms | 748 KB | Output is correct |
4 | Correct | 2 ms | 748 KB | Output is correct |
5 | Correct | 2 ms | 756 KB | Output is correct |
6 | Correct | 2 ms | 756 KB | Output is correct |
7 | Correct | 2 ms | 756 KB | Output is correct |
8 | Correct | 2 ms | 756 KB | Output is correct |
9 | Correct | 2 ms | 772 KB | Output is correct |
10 | Correct | 2 ms | 776 KB | Output is correct |
11 | Correct | 2 ms | 776 KB | Output is correct |
12 | Correct | 2 ms | 776 KB | Output is correct |
13 | Correct | 2 ms | 776 KB | Output is correct |
14 | Correct | 2 ms | 792 KB | Output is correct |
15 | Correct | 2 ms | 796 KB | Output is correct |
16 | Correct | 2 ms | 796 KB | Output is correct |
17 | Correct | 2 ms | 800 KB | Output is correct |
18 | Correct | 2 ms | 940 KB | Output is correct |
19 | Correct | 2 ms | 940 KB | Output is correct |
20 | Correct | 2 ms | 940 KB | Output is correct |
21 | Correct | 2 ms | 940 KB | Output is correct |
22 | Correct | 2 ms | 940 KB | Output is correct |
23 | Correct | 2 ms | 940 KB | Output is correct |
24 | Correct | 4 ms | 940 KB | Output is correct |
25 | Correct | 2 ms | 940 KB | Output is correct |
26 | Correct | 2 ms | 980 KB | Output is correct |
27 | Correct | 2 ms | 980 KB | Output is correct |
28 | Correct | 2 ms | 980 KB | Output is correct |
29 | Correct | 2 ms | 980 KB | Output is correct |
30 | Correct | 3 ms | 980 KB | Output is correct |
31 | Correct | 2 ms | 980 KB | Output is correct |
32 | Correct | 2 ms | 980 KB | Output is correct |
33 | Correct | 2 ms | 980 KB | Output is correct |
34 | Correct | 2 ms | 980 KB | Output is correct |
35 | Correct | 2 ms | 980 KB | Output is correct |
36 | Correct | 2 ms | 980 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 980 KB | Output is correct |
2 | Correct | 2 ms | 980 KB | Output is correct |
3 | Correct | 2 ms | 980 KB | Output is correct |
4 | Correct | 2 ms | 980 KB | Output is correct |
5 | Correct | 2 ms | 980 KB | Output is correct |
6 | Correct | 2 ms | 1048 KB | Output is correct |
7 | Correct | 2 ms | 1048 KB | Output is correct |
8 | Correct | 2 ms | 1048 KB | Output is correct |
9 | Correct | 2 ms | 1048 KB | Output is correct |
10 | Correct | 2 ms | 1048 KB | Output is correct |
11 | Correct | 2 ms | 1048 KB | Output is correct |
12 | Correct | 2 ms | 1048 KB | Output is correct |
13 | Correct | 3 ms | 1048 KB | Output is correct |
14 | Correct | 2 ms | 1048 KB | Output is correct |
15 | Correct | 2 ms | 1048 KB | Output is correct |
16 | Correct | 2 ms | 1092 KB | Output is correct |
17 | Correct | 2 ms | 1092 KB | Output is correct |
18 | Correct | 2 ms | 1092 KB | Output is correct |
19 | Correct | 2 ms | 1092 KB | Output is correct |
20 | Correct | 2 ms | 1092 KB | Output is correct |
21 | Correct | 2 ms | 1092 KB | Output is correct |
22 | Correct | 2 ms | 1092 KB | Output is correct |
23 | Correct | 2 ms | 1092 KB | Output is correct |
24 | Correct | 2 ms | 1092 KB | Output is correct |
25 | Correct | 2 ms | 1092 KB | Output is correct |
26 | Correct | 2 ms | 1092 KB | Output is correct |
27 | Correct | 2 ms | 1092 KB | Output is correct |
28 | Correct | 3 ms | 1092 KB | Output is correct |
29 | Correct | 2 ms | 1092 KB | Output is correct |
30 | Correct | 2 ms | 1092 KB | Output is correct |
31 | Correct | 2 ms | 1092 KB | Output is correct |
32 | Correct | 3 ms | 1092 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 1092 KB | Output is correct |
2 | Correct | 2 ms | 1092 KB | Output is correct |
3 | Correct | 2 ms | 1092 KB | Output is correct |
4 | Correct | 2 ms | 1092 KB | Output is correct |
5 | Correct | 3 ms | 1092 KB | Output is correct |
6 | Correct | 2 ms | 1092 KB | Output is correct |
7 | Correct | 2 ms | 1092 KB | Output is correct |
8 | Correct | 2 ms | 1092 KB | Output is correct |
9 | Correct | 2 ms | 1092 KB | Output is correct |
10 | Correct | 2 ms | 1092 KB | Output is correct |
11 | Correct | 2 ms | 1092 KB | Output is correct |
12 | Correct | 2 ms | 1092 KB | Output is correct |
13 | Correct | 2 ms | 1200 KB | Output is correct |
14 | Correct | 2 ms | 1204 KB | Output is correct |
15 | Correct | 2 ms | 1204 KB | Output is correct |
16 | Correct | 2 ms | 1204 KB | Output is correct |
17 | Correct | 2 ms | 1204 KB | Output is correct |
18 | Correct | 2 ms | 1204 KB | Output is correct |
19 | Correct | 2 ms | 1204 KB | Output is correct |
20 | Correct | 2 ms | 1204 KB | Output is correct |
21 | Correct | 2 ms | 1204 KB | Output is correct |
22 | Correct | 2 ms | 1204 KB | Output is correct |
23 | Correct | 2 ms | 1204 KB | Output is correct |
24 | Correct | 2 ms | 1204 KB | Output is correct |
25 | Correct | 2 ms | 1204 KB | Output is correct |
26 | Correct | 4 ms | 1204 KB | Output is correct |
27 | Correct | 2 ms | 1204 KB | Output is correct |
28 | Correct | 2 ms | 1204 KB | Output is correct |
29 | Correct | 2 ms | 1204 KB | Output is correct |
30 | Correct | 2 ms | 1204 KB | Output is correct |
31 | Correct | 2 ms | 1236 KB | Output is correct |
32 | Correct | 2 ms | 1236 KB | Output is correct |
33 | Correct | 2 ms | 1236 KB | Output is correct |
34 | Correct | 2 ms | 1236 KB | Output is correct |
35 | Correct | 2 ms | 1236 KB | Output is correct |
36 | Correct | 2 ms | 1236 KB | Output is correct |
37 | Correct | 2 ms | 1236 KB | Output is correct |
38 | Correct | 2 ms | 1300 KB | Output is correct |
39 | Correct | 2 ms | 1300 KB | Output is correct |
40 | Correct | 2 ms | 1300 KB | Output is correct |
41 | Correct | 2 ms | 1300 KB | Output is correct |
42 | Correct | 2 ms | 1300 KB | Output is correct |
43 | Correct | 2 ms | 1300 KB | Output is correct |
44 | Correct | 2 ms | 1300 KB | Output is correct |
45 | Correct | 2 ms | 1300 KB | Output is correct |
46 | Correct | 2 ms | 1300 KB | Output is correct |
47 | Correct | 2 ms | 1300 KB | Output is correct |
48 | Correct | 3 ms | 1300 KB | Output is correct |
49 | Correct | 2 ms | 1300 KB | Output is correct |
50 | Correct | 2 ms | 1300 KB | Output is correct |
51 | Correct | 3 ms | 1300 KB | Output is correct |
52 | Correct | 2 ms | 1300 KB | Output is correct |
53 | Correct | 2 ms | 1300 KB | Output is correct |
54 | Correct | 3 ms | 1300 KB | Output is correct |
55 | Correct | 2 ms | 1300 KB | Output is correct |
56 | Correct | 2 ms | 1376 KB | Output is correct |
57 | Correct | 3 ms | 1376 KB | Output is correct |
58 | Correct | 2 ms | 1376 KB | Output is correct |
59 | Correct | 3 ms | 1376 KB | Output is correct |
60 | Correct | 3 ms | 1376 KB | Output is correct |
61 | Correct | 2 ms | 1376 KB | Output is correct |
62 | Correct | 3 ms | 1376 KB | Output is correct |
63 | Correct | 4 ms | 1376 KB | Output is correct |
64 | Correct | 12 ms | 1376 KB | Output is correct |
65 | Correct | 3 ms | 1376 KB | Output is correct |
66 | Correct | 3 ms | 1376 KB | Output is correct |
67 | Correct | 3 ms | 1376 KB | Output is correct |
68 | Correct | 5 ms | 1376 KB | Output is correct |
69 | Correct | 20 ms | 1376 KB | Output is correct |
70 | Correct | 10 ms | 1376 KB | Output is correct |
71 | Correct | 3 ms | 1376 KB | Output is correct |
72 | Correct | 3 ms | 1376 KB | Output is correct |
73 | Correct | 10 ms | 1376 KB | Output is correct |
74 | Correct | 8 ms | 1376 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 1376 KB | Output is correct |
2 | Correct | 2 ms | 1376 KB | Output is correct |
3 | Correct | 2 ms | 1376 KB | Output is correct |
4 | Correct | 2 ms | 1376 KB | Output is correct |
5 | Correct | 2 ms | 1376 KB | Output is correct |
6 | Correct | 2 ms | 1376 KB | Output is correct |
7 | Correct | 3 ms | 1376 KB | Output is correct |
8 | Correct | 2 ms | 1376 KB | Output is correct |
9 | Correct | 2 ms | 1376 KB | Output is correct |
10 | Correct | 2 ms | 1376 KB | Output is correct |
11 | Correct | 2 ms | 1376 KB | Output is correct |
12 | Correct | 2 ms | 1376 KB | Output is correct |
13 | Correct | 2 ms | 1492 KB | Output is correct |
14 | Correct | 2 ms | 1492 KB | Output is correct |
15 | Correct | 2 ms | 1492 KB | Output is correct |
16 | Correct | 3 ms | 1492 KB | Output is correct |
17 | Correct | 2 ms | 1492 KB | Output is correct |
18 | Correct | 2 ms | 1492 KB | Output is correct |
19 | Correct | 2 ms | 1492 KB | Output is correct |
20 | Correct | 2 ms | 1492 KB | Output is correct |
21 | Correct | 2 ms | 1492 KB | Output is correct |
22 | Correct | 2 ms | 1492 KB | Output is correct |
23 | Correct | 2 ms | 1492 KB | Output is correct |
24 | Correct | 2 ms | 1492 KB | Output is correct |
25 | Correct | 2 ms | 1492 KB | Output is correct |
26 | Correct | 2 ms | 1492 KB | Output is correct |
27 | Correct | 2 ms | 1492 KB | Output is correct |
28 | Correct | 2 ms | 1492 KB | Output is correct |
29 | Correct | 2 ms | 1492 KB | Output is correct |
30 | Correct | 2 ms | 1492 KB | Output is correct |
31 | Correct | 2 ms | 1492 KB | Output is correct |
32 | Correct | 2 ms | 1492 KB | Output is correct |
33 | Correct | 2 ms | 1492 KB | Output is correct |
34 | Correct | 2 ms | 1492 KB | Output is correct |
35 | Correct | 2 ms | 1492 KB | Output is correct |
36 | Correct | 2 ms | 1492 KB | Output is correct |
37 | Correct | 2 ms | 1492 KB | Output is correct |
38 | Correct | 2 ms | 1492 KB | Output is correct |
39 | Correct | 2 ms | 1492 KB | Output is correct |
40 | Correct | 2 ms | 1492 KB | Output is correct |
41 | Correct | 2 ms | 1492 KB | Output is correct |
42 | Correct | 2 ms | 1492 KB | Output is correct |
43 | Correct | 2 ms | 1492 KB | Output is correct |
44 | Correct | 3 ms | 1492 KB | Output is correct |
45 | Correct | 3 ms | 1492 KB | Output is correct |
46 | Correct | 3 ms | 1492 KB | Output is correct |
47 | Correct | 3 ms | 1492 KB | Output is correct |
48 | Correct | 2 ms | 1492 KB | Output is correct |
49 | Correct | 3 ms | 1500 KB | Output is correct |
50 | Correct | 3 ms | 1504 KB | Output is correct |
51 | Correct | 3 ms | 1508 KB | Output is correct |
52 | Correct | 131 ms | 1508 KB | Output is correct |
53 | Correct | 116 ms | 1512 KB | Output is correct |
54 | Correct | 230 ms | 1520 KB | Output is correct |
55 | Correct | 269 ms | 1520 KB | Output is correct |
56 | Execution timed out | 1076 ms | 1672 KB | Time limit exceeded |
57 | Halted | 0 ms | 0 KB | - |