# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
41399 | 2018-02-17T06:54:16 Z | fest | Bali Sculptures (APIO15_sculpture) | C++14 | 91 ms | 752 KB |
// fest #include <bits/stdc++.h> #define pb push_back #define F first #define S second #define y1 dasdasfasfas #define x1 wqdadfasfasfas #define All(c) c.begin(), c.end() #define SZ(A) (int((A).size())) #define umap unordered_map #define FILENAME "" #define __ fflush(stdout) typedef long long ll; typedef long double ld; using namespace std; void FREOPEN() { #ifdef COMP freopen(".in", "r", stdin); freopen("2.out", "w", stdout); #else freopen(FILENAME".in", "r", stdin); freopen(FILENAME".out", "w", stdout); #endif } inline double Time() {return (clock() * 1.0) / CLOCKS_PER_SEC; } const int N = 2001, inf = 1e9 * 2, MOD = (int)1e9 + 7, M = 42; char CH[N]; const ll INF = 1e18; const int dx[] = {1, -1, 0, 0, -1, 1, -1, 1}; const int dy[] = {0, 0, 1, -1, -1, 1, 1, -1}; ll a[N]; int dp[N]; int main() { int n, l, r; cin >> n >> l >> r; for (int i = 1; i <= n; i++) scanf("%lld ", a + i); ll ans = 0; ll no = 0; for (int bit = M - 1; bit >= 0; bit--) { ll now = (ans | (1ll << bit)); now--; no |= (1ll << bit); for (int i = 1; i <= n; i++) dp[i] = inf; for (int i = 1; i <= n; i++) { ll sum = a[i]; for (int j = i - 1; j >= 0; j--) { if (sum & no) { sum += a[j]; continue; } if (sum > now) break; dp[i] = min(dp[i], dp[j] + 1); sum += a[j]; } } no ^= (1ll << bit); if (dp[n] <= r) no |= (1ll << bit); else ans |= (1ll << bit); } cout << ans; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 248 KB | Output is correct |
2 | Correct | 2 ms | 352 KB | Output is correct |
3 | Correct | 2 ms | 352 KB | Output is correct |
4 | Correct | 1 ms | 404 KB | Output is correct |
5 | Correct | 1 ms | 464 KB | Output is correct |
6 | Correct | 2 ms | 464 KB | Output is correct |
7 | Correct | 2 ms | 480 KB | Output is correct |
8 | Correct | 2 ms | 480 KB | Output is correct |
9 | Correct | 2 ms | 480 KB | Output is correct |
10 | Correct | 1 ms | 532 KB | Output is correct |
11 | Correct | 1 ms | 604 KB | Output is correct |
12 | Correct | 2 ms | 604 KB | Output is correct |
13 | Correct | 2 ms | 604 KB | Output is correct |
14 | Correct | 2 ms | 604 KB | Output is correct |
15 | Incorrect | 1 ms | 604 KB | Output isn't correct |
16 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 604 KB | Output is correct |
2 | Correct | 1 ms | 604 KB | Output is correct |
3 | Correct | 1 ms | 604 KB | Output is correct |
4 | Correct | 2 ms | 604 KB | Output is correct |
5 | Correct | 1 ms | 604 KB | Output is correct |
6 | Correct | 2 ms | 604 KB | Output is correct |
7 | Correct | 2 ms | 604 KB | Output is correct |
8 | Correct | 1 ms | 604 KB | Output is correct |
9 | Correct | 1 ms | 620 KB | Output is correct |
10 | Correct | 2 ms | 620 KB | Output is correct |
11 | Correct | 1 ms | 620 KB | Output is correct |
12 | Correct | 1 ms | 620 KB | Output is correct |
13 | Correct | 1 ms | 620 KB | Output is correct |
14 | Correct | 1 ms | 620 KB | Output is correct |
15 | Incorrect | 1 ms | 620 KB | Output isn't correct |
16 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 620 KB | Output is correct |
2 | Correct | 2 ms | 620 KB | Output is correct |
3 | Correct | 1 ms | 620 KB | Output is correct |
4 | Correct | 1 ms | 620 KB | Output is correct |
5 | Correct | 1 ms | 620 KB | Output is correct |
6 | Correct | 1 ms | 620 KB | Output is correct |
7 | Correct | 1 ms | 620 KB | Output is correct |
8 | Correct | 1 ms | 620 KB | Output is correct |
9 | Correct | 1 ms | 620 KB | Output is correct |
10 | Correct | 1 ms | 620 KB | Output is correct |
11 | Correct | 1 ms | 620 KB | Output is correct |
12 | Correct | 2 ms | 620 KB | Output is correct |
13 | Correct | 1 ms | 620 KB | Output is correct |
14 | Correct | 1 ms | 620 KB | Output is correct |
15 | Correct | 1 ms | 620 KB | Output is correct |
16 | Correct | 1 ms | 620 KB | Output is correct |
17 | Correct | 1 ms | 620 KB | Output is correct |
18 | Correct | 2 ms | 620 KB | Output is correct |
19 | Correct | 2 ms | 620 KB | Output is correct |
20 | Correct | 2 ms | 620 KB | Output is correct |
21 | Correct | 2 ms | 620 KB | Output is correct |
22 | Correct | 2 ms | 620 KB | Output is correct |
23 | Correct | 2 ms | 620 KB | Output is correct |
24 | Correct | 2 ms | 620 KB | Output is correct |
25 | Correct | 2 ms | 620 KB | Output is correct |
26 | Correct | 2 ms | 620 KB | Output is correct |
27 | Correct | 2 ms | 620 KB | Output is correct |
28 | Correct | 2 ms | 620 KB | Output is correct |
29 | Correct | 2 ms | 620 KB | Output is correct |
30 | Correct | 2 ms | 620 KB | Output is correct |
31 | Correct | 2 ms | 620 KB | Output is correct |
32 | Correct | 2 ms | 620 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 620 KB | Output is correct |
2 | Correct | 2 ms | 620 KB | Output is correct |
3 | Correct | 1 ms | 620 KB | Output is correct |
4 | Correct | 1 ms | 620 KB | Output is correct |
5 | Correct | 1 ms | 620 KB | Output is correct |
6 | Correct | 1 ms | 620 KB | Output is correct |
7 | Correct | 1 ms | 620 KB | Output is correct |
8 | Correct | 1 ms | 620 KB | Output is correct |
9 | Correct | 1 ms | 620 KB | Output is correct |
10 | Correct | 1 ms | 620 KB | Output is correct |
11 | Correct | 1 ms | 620 KB | Output is correct |
12 | Correct | 2 ms | 620 KB | Output is correct |
13 | Correct | 1 ms | 620 KB | Output is correct |
14 | Correct | 2 ms | 620 KB | Output is correct |
15 | Incorrect | 1 ms | 620 KB | Output isn't correct |
16 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 620 KB | Output is correct |
2 | Correct | 2 ms | 620 KB | Output is correct |
3 | Correct | 2 ms | 620 KB | Output is correct |
4 | Correct | 1 ms | 620 KB | Output is correct |
5 | Correct | 2 ms | 620 KB | Output is correct |
6 | Correct | 2 ms | 620 KB | Output is correct |
7 | Correct | 1 ms | 620 KB | Output is correct |
8 | Correct | 1 ms | 620 KB | Output is correct |
9 | Correct | 1 ms | 620 KB | Output is correct |
10 | Correct | 1 ms | 624 KB | Output is correct |
11 | Correct | 1 ms | 624 KB | Output is correct |
12 | Correct | 2 ms | 624 KB | Output is correct |
13 | Correct | 2 ms | 624 KB | Output is correct |
14 | Correct | 1 ms | 624 KB | Output is correct |
15 | Correct | 1 ms | 624 KB | Output is correct |
16 | Correct | 1 ms | 624 KB | Output is correct |
17 | Correct | 1 ms | 624 KB | Output is correct |
18 | Correct | 2 ms | 624 KB | Output is correct |
19 | Correct | 1 ms | 624 KB | Output is correct |
20 | Correct | 1 ms | 624 KB | Output is correct |
21 | Correct | 1 ms | 624 KB | Output is correct |
22 | Correct | 1 ms | 624 KB | Output is correct |
23 | Correct | 1 ms | 624 KB | Output is correct |
24 | Correct | 2 ms | 624 KB | Output is correct |
25 | Correct | 2 ms | 624 KB | Output is correct |
26 | Correct | 1 ms | 624 KB | Output is correct |
27 | Correct | 2 ms | 624 KB | Output is correct |
28 | Correct | 2 ms | 624 KB | Output is correct |
29 | Correct | 1 ms | 624 KB | Output is correct |
30 | Correct | 2 ms | 624 KB | Output is correct |
31 | Correct | 2 ms | 624 KB | Output is correct |
32 | Correct | 1 ms | 624 KB | Output is correct |
33 | Correct | 1 ms | 624 KB | Output is correct |
34 | Correct | 2 ms | 624 KB | Output is correct |
35 | Correct | 2 ms | 624 KB | Output is correct |
36 | Correct | 2 ms | 624 KB | Output is correct |
37 | Correct | 2 ms | 624 KB | Output is correct |
38 | Correct | 2 ms | 624 KB | Output is correct |
39 | Correct | 2 ms | 624 KB | Output is correct |
40 | Correct | 2 ms | 624 KB | Output is correct |
41 | Correct | 3 ms | 624 KB | Output is correct |
42 | Correct | 3 ms | 624 KB | Output is correct |
43 | Correct | 2 ms | 624 KB | Output is correct |
44 | Correct | 2 ms | 624 KB | Output is correct |
45 | Correct | 2 ms | 624 KB | Output is correct |
46 | Correct | 3 ms | 624 KB | Output is correct |
47 | Correct | 2 ms | 624 KB | Output is correct |
48 | Correct | 2 ms | 624 KB | Output is correct |
49 | Correct | 2 ms | 624 KB | Output is correct |
50 | Correct | 2 ms | 624 KB | Output is correct |
51 | Correct | 2 ms | 624 KB | Output is correct |
52 | Correct | 10 ms | 624 KB | Output is correct |
53 | Correct | 14 ms | 624 KB | Output is correct |
54 | Correct | 27 ms | 624 KB | Output is correct |
55 | Correct | 25 ms | 624 KB | Output is correct |
56 | Correct | 83 ms | 624 KB | Output is correct |
57 | Correct | 83 ms | 624 KB | Output is correct |
58 | Correct | 79 ms | 624 KB | Output is correct |
59 | Correct | 77 ms | 624 KB | Output is correct |
60 | Correct | 91 ms | 624 KB | Output is correct |
61 | Correct | 2 ms | 624 KB | Output is correct |
62 | Correct | 14 ms | 624 KB | Output is correct |
63 | Correct | 26 ms | 624 KB | Output is correct |
64 | Correct | 23 ms | 624 KB | Output is correct |
65 | Correct | 42 ms | 632 KB | Output is correct |
66 | Correct | 62 ms | 632 KB | Output is correct |
67 | Correct | 82 ms | 632 KB | Output is correct |
68 | Correct | 89 ms | 752 KB | Output is correct |
69 | Correct | 79 ms | 752 KB | Output is correct |