# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
107893 | 2019-04-26T07:33:02 Z | patrikpavic2 | Bali Sculptures (APIO15_sculpture) | C++17 | 686 ms | 23288 KB |
#include <cstdio> #include <cstring> #include <ctime> #include <cstdlib> #include <algorithm> #include <vector> #include <set> #include <map> #include <queue> #include <deque> #define X first #define Y second #define PB push_back using namespace std; typedef long long ll; typedef pair < int, int > pii; typedef vector < int > vi; typedef set < int > si; const int N = 2050; const int M = 1e6 + 500; const int INF = 0x3f3f3f3f; const int MOD = 1e9 + 7; const int LOG = 18; const int OFF = (1 << LOG); const double EPS = 1e-9; const double PI = 3.1415926535; ll sum[N][N], ans = 0; int dp[N], A, B, x[N], n; bool check(int k){ for(int i = 0;i < n;i++){ dp[i] = INF; for(int j = -1;j < i;j++){ if((sum[j + 1][i] & (~ans)) < (1LL << k)) dp[i] = min(1 + (j >= 0 ? dp[j] : 0), dp[i]); } } return dp[n - 1] <= B; } int main(){ scanf("%d%d%d", &n, &A, &B); for(int i = 0;i < n;i++) scanf("%d", x + i); for(int i = 0;i < n;i++){ ll cur = 0; for(int j = i;j < n;j++){ cur += (ll)x[j]; sum[i][j] = cur; } } for(int i = 45; i >= 0;i--) if(!check(i)) ans |= (1LL << i); printf("%lld\n", ans); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 2 ms | 256 KB | Output is correct |
4 | Correct | 2 ms | 384 KB | Output is correct |
5 | Correct | 2 ms | 384 KB | Output is correct |
6 | Correct | 2 ms | 384 KB | Output is correct |
7 | Correct | 2 ms | 384 KB | Output is correct |
8 | Correct | 2 ms | 384 KB | Output is correct |
9 | Correct | 2 ms | 384 KB | Output is correct |
10 | Correct | 3 ms | 384 KB | Output is correct |
11 | Correct | 3 ms | 384 KB | Output is correct |
12 | Correct | 3 ms | 384 KB | Output is correct |
13 | Correct | 2 ms | 384 KB | Output is correct |
14 | Correct | 2 ms | 384 KB | Output is correct |
15 | Incorrect | 2 ms | 384 KB | Output isn't correct |
16 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 3 ms | 256 KB | Output is correct |
4 | Correct | 2 ms | 384 KB | Output is correct |
5 | Correct | 2 ms | 384 KB | Output is correct |
6 | Correct | 2 ms | 384 KB | Output is correct |
7 | Correct | 2 ms | 384 KB | Output is correct |
8 | Correct | 2 ms | 384 KB | Output is correct |
9 | Correct | 2 ms | 256 KB | Output is correct |
10 | Correct | 2 ms | 384 KB | Output is correct |
11 | Correct | 2 ms | 384 KB | Output is correct |
12 | Correct | 3 ms | 384 KB | Output is correct |
13 | Correct | 2 ms | 384 KB | Output is correct |
14 | Correct | 3 ms | 384 KB | Output is correct |
15 | Incorrect | 2 ms | 384 KB | Output isn't correct |
16 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 2 ms | 256 KB | Output is correct |
4 | Correct | 2 ms | 384 KB | Output is correct |
5 | Correct | 2 ms | 384 KB | Output is correct |
6 | Correct | 2 ms | 384 KB | Output is correct |
7 | Correct | 2 ms | 384 KB | Output is correct |
8 | Correct | 2 ms | 384 KB | Output is correct |
9 | Correct | 2 ms | 384 KB | Output is correct |
10 | Correct | 2 ms | 384 KB | Output is correct |
11 | Correct | 2 ms | 384 KB | Output is correct |
12 | Correct | 2 ms | 384 KB | Output is correct |
13 | Correct | 3 ms | 384 KB | Output is correct |
14 | Correct | 2 ms | 384 KB | Output is correct |
15 | Correct | 2 ms | 384 KB | Output is correct |
16 | Correct | 2 ms | 512 KB | Output is correct |
17 | Correct | 2 ms | 512 KB | Output is correct |
18 | Correct | 2 ms | 512 KB | Output is correct |
19 | Correct | 3 ms | 512 KB | Output is correct |
20 | Correct | 2 ms | 512 KB | Output is correct |
21 | Correct | 2 ms | 512 KB | Output is correct |
22 | Correct | 2 ms | 512 KB | Output is correct |
23 | Correct | 2 ms | 512 KB | Output is correct |
24 | Correct | 2 ms | 512 KB | Output is correct |
25 | Correct | 3 ms | 640 KB | Output is correct |
26 | Correct | 3 ms | 640 KB | Output is correct |
27 | Correct | 3 ms | 768 KB | Output is correct |
28 | Correct | 5 ms | 896 KB | Output is correct |
29 | Correct | 3 ms | 896 KB | Output is correct |
30 | Correct | 3 ms | 768 KB | Output is correct |
31 | Correct | 3 ms | 896 KB | Output is correct |
32 | Correct | 3 ms | 896 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 2 ms | 384 KB | Output is correct |
4 | Correct | 2 ms | 384 KB | Output is correct |
5 | Correct | 2 ms | 384 KB | Output is correct |
6 | Correct | 2 ms | 384 KB | Output is correct |
7 | Correct | 2 ms | 384 KB | Output is correct |
8 | Correct | 2 ms | 384 KB | Output is correct |
9 | Correct | 2 ms | 384 KB | Output is correct |
10 | Correct | 2 ms | 384 KB | Output is correct |
11 | Correct | 2 ms | 384 KB | Output is correct |
12 | Correct | 2 ms | 384 KB | Output is correct |
13 | Correct | 3 ms | 432 KB | Output is correct |
14 | Correct | 2 ms | 384 KB | Output is correct |
15 | Incorrect | 2 ms | 384 KB | Output isn't correct |
16 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 2 ms | 256 KB | Output is correct |
4 | Correct | 2 ms | 384 KB | Output is correct |
5 | Correct | 2 ms | 384 KB | Output is correct |
6 | Correct | 1 ms | 384 KB | Output is correct |
7 | Correct | 2 ms | 384 KB | Output is correct |
8 | Correct | 3 ms | 384 KB | Output is correct |
9 | Correct | 2 ms | 384 KB | Output is correct |
10 | Correct | 2 ms | 384 KB | Output is correct |
11 | Correct | 2 ms | 384 KB | Output is correct |
12 | Correct | 2 ms | 384 KB | Output is correct |
13 | Correct | 2 ms | 460 KB | Output is correct |
14 | Correct | 2 ms | 384 KB | Output is correct |
15 | Correct | 2 ms | 384 KB | Output is correct |
16 | Correct | 2 ms | 384 KB | Output is correct |
17 | Correct | 2 ms | 384 KB | Output is correct |
18 | Correct | 2 ms | 384 KB | Output is correct |
19 | Correct | 2 ms | 384 KB | Output is correct |
20 | Correct | 2 ms | 412 KB | Output is correct |
21 | Correct | 3 ms | 384 KB | Output is correct |
22 | Correct | 2 ms | 512 KB | Output is correct |
23 | Correct | 2 ms | 384 KB | Output is correct |
24 | Correct | 2 ms | 384 KB | Output is correct |
25 | Correct | 2 ms | 384 KB | Output is correct |
26 | Correct | 2 ms | 512 KB | Output is correct |
27 | Correct | 2 ms | 512 KB | Output is correct |
28 | Correct | 2 ms | 512 KB | Output is correct |
29 | Correct | 2 ms | 512 KB | Output is correct |
30 | Correct | 2 ms | 512 KB | Output is correct |
31 | Correct | 2 ms | 512 KB | Output is correct |
32 | Correct | 3 ms | 512 KB | Output is correct |
33 | Correct | 2 ms | 512 KB | Output is correct |
34 | Correct | 2 ms | 512 KB | Output is correct |
35 | Correct | 3 ms | 640 KB | Output is correct |
36 | Correct | 2 ms | 640 KB | Output is correct |
37 | Correct | 2 ms | 768 KB | Output is correct |
38 | Correct | 3 ms | 896 KB | Output is correct |
39 | Correct | 4 ms | 768 KB | Output is correct |
40 | Correct | 4 ms | 896 KB | Output is correct |
41 | Correct | 3 ms | 896 KB | Output is correct |
42 | Correct | 3 ms | 896 KB | Output is correct |
43 | Correct | 7 ms | 512 KB | Output is correct |
44 | Correct | 3 ms | 768 KB | Output is correct |
45 | Correct | 3 ms | 768 KB | Output is correct |
46 | Correct | 3 ms | 896 KB | Output is correct |
47 | Correct | 2 ms | 640 KB | Output is correct |
48 | Correct | 2 ms | 896 KB | Output is correct |
49 | Correct | 2 ms | 768 KB | Output is correct |
50 | Correct | 3 ms | 896 KB | Output is correct |
51 | Correct | 2 ms | 768 KB | Output is correct |
52 | Correct | 17 ms | 3968 KB | Output is correct |
53 | Correct | 27 ms | 5504 KB | Output is correct |
54 | Correct | 83 ms | 8192 KB | Output is correct |
55 | Correct | 70 ms | 8288 KB | Output is correct |
56 | Correct | 663 ms | 23288 KB | Output is correct |
57 | Correct | 602 ms | 23288 KB | Output is correct |
58 | Correct | 616 ms | 23204 KB | Output is correct |
59 | Correct | 575 ms | 23288 KB | Output is correct |
60 | Correct | 686 ms | 23240 KB | Output is correct |
61 | Correct | 3 ms | 896 KB | Output is correct |
62 | Correct | 29 ms | 5504 KB | Output is correct |
63 | Correct | 117 ms | 8320 KB | Output is correct |
64 | Correct | 104 ms | 8292 KB | Output is correct |
65 | Correct | 324 ms | 13696 KB | Output is correct |
66 | Correct | 450 ms | 19192 KB | Output is correct |
67 | Correct | 655 ms | 23264 KB | Output is correct |
68 | Correct | 571 ms | 23204 KB | Output is correct |
69 | Correct | 561 ms | 23288 KB | Output is correct |