# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
917188 | 2024-01-27T12:03:54 Z | hariaakas646 | Bali Sculptures (APIO15_sculpture) | C++14 | 1000 ms | 4952 KB |
#include <bits/stdc++.h> using namespace std; #define scd(t) scanf("%d", &t) #define sclld(t) scanf("%lld", &t) #define forr(i, l, r) for(int i=l; i<r; i++) #define frange(i, l) forr(i, 0, l) #define pb push_back #define mp make_pair #define f first #define s second #define all(x) x.begin(), x.end() typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pii> vii; typedef long long lli; typedef vector<vi> vvi; typedef vector<lli> vll; typedef vector<bool> vb; typedef set<int> seti; typedef multiset<int> mseti; void usaco() { freopen("/media/hariaakash646/785EF1075EF0BF46/CompetitiveProgramming/input.in", "r", stdin); } // int dp[101][2049] = {int(1e9)}; int main() { // usaco(); int n, a, b; scd(n); scd(a); scd(b); vll vec(n+1); forr(i, 1, n+1) sclld(vec[i]); vector<vll> val(n+1, vll(b+1)); lli mask = (1LL<<46) - 1; for(int i=45; i>=0; i--) { // dp = vector<vll>(n+1, vll(b+1, 1e18 - 1)); mask = mask ^ (1LL<<i); vector<vb> dp(n+1, vb(b+1)); dp[0][0] = true; forr(j, 0, n) { forr(k, 0, b) { if(dp[j][k]) { lli tot = 0; for(int l=j+1; l<=n; l++) { tot += vec[l]; if((mask | tot) == mask) dp[l][k+1] = true; } } } } bool done = false; forr(k, a, b+1) { if(dp[n][k]) done = true; } if(!done) mask = mask | (1LL<<i); } // forr(i, 1, n+1) { // forr(j, 1, b+1) printf("%lld ", dp[i][j]); // printf("\n"); // } // lli mi = 1e15; // forr(i, a, b+1) mi = min(mi, val[n][i]); printf("%lld", mask); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 1 ms | 508 KB | Output is correct |
7 | Correct | 0 ms | 432 KB | Output is correct |
8 | Correct | 0 ms | 348 KB | Output is correct |
9 | Correct | 0 ms | 348 KB | Output is correct |
10 | Correct | 0 ms | 348 KB | Output is correct |
11 | Correct | 1 ms | 348 KB | Output is correct |
12 | Correct | 0 ms | 348 KB | Output is correct |
13 | Correct | 1 ms | 348 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 | 436 KB | Output is correct |
17 | Correct | 0 ms | 348 KB | Output is correct |
18 | Correct | 0 ms | 432 KB | Output is correct |
19 | Correct | 1 ms | 348 KB | Output is correct |
20 | Correct | 0 ms | 348 KB | Output is correct |
21 | Correct | 1 ms | 348 KB | Output is correct |
22 | Correct | 0 ms | 348 KB | Output is correct |
23 | Correct | 1 ms | 348 KB | Output is correct |
24 | Correct | 0 ms | 348 KB | Output is correct |
25 | Correct | 1 ms | 348 KB | Output is correct |
26 | Correct | 1 ms | 348 KB | Output is correct |
27 | Correct | 0 ms | 348 KB | Output is correct |
28 | Correct | 0 ms | 436 KB | Output is correct |
29 | Correct | 0 ms | 348 KB | Output is correct |
30 | Correct | 1 ms | 348 KB | Output is correct |
31 | Correct | 1 ms | 348 KB | Output is correct |
32 | Correct | 0 ms | 348 KB | Output is correct |
33 | Correct | 1 ms | 348 KB | Output is correct |
34 | Correct | 1 ms | 344 KB | Output is correct |
35 | Correct | 1 ms | 348 KB | Output is correct |
36 | Correct | 1 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 1 ms | 348 KB | Output is correct |
7 | Correct | 0 ms | 348 KB | Output is correct |
8 | Correct | 1 ms | 344 KB | Output is correct |
9 | Correct | 1 ms | 344 KB | Output is correct |
10 | Correct | 1 ms | 348 KB | Output is correct |
11 | Correct | 0 ms | 436 KB | Output is correct |
12 | Correct | 0 ms | 348 KB | Output is correct |
13 | Correct | 1 ms | 348 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 | 348 KB | Output is correct |
17 | Correct | 0 ms | 344 KB | Output is correct |
18 | Correct | 0 ms | 348 KB | Output is correct |
19 | Correct | 1 ms | 348 KB | Output is correct |
20 | Correct | 1 ms | 348 KB | Output is correct |
21 | Correct | 1 ms | 348 KB | Output is correct |
22 | Correct | 1 ms | 348 KB | Output is correct |
23 | Correct | 0 ms | 348 KB | Output is correct |
24 | Correct | 1 ms | 344 KB | Output is correct |
25 | Correct | 1 ms | 348 KB | Output is correct |
26 | Correct | 0 ms | 348 KB | Output is correct |
27 | Correct | 1 ms | 348 KB | Output is correct |
28 | Correct | 1 ms | 344 KB | Output is correct |
29 | Correct | 1 ms | 348 KB | Output is correct |
30 | Correct | 1 ms | 432 KB | Output is correct |
31 | Correct | 1 ms | 348 KB | Output is correct |
32 | Correct | 1 ms | 348 KB | Output is correct |
33 | Correct | 0 ms | 348 KB | Output is correct |
34 | Correct | 2 ms | 348 KB | Output is correct |
35 | Correct | 1 ms | 440 KB | Output is correct |
36 | Correct | 1 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 1 ms | 344 KB | Output is correct |
6 | Correct | 1 ms | 348 KB | Output is correct |
7 | Correct | 0 ms | 348 KB | Output is correct |
8 | Correct | 0 ms | 348 KB | Output is correct |
9 | Correct | 0 ms | 348 KB | Output is correct |
10 | Correct | 0 ms | 348 KB | Output is correct |
11 | Correct | 0 ms | 348 KB | Output is correct |
12 | Correct | 0 ms | 348 KB | Output is correct |
13 | Correct | 1 ms | 348 KB | Output is correct |
14 | Correct | 1 ms | 348 KB | Output is correct |
15 | Correct | 1 ms | 372 KB | Output is correct |
16 | Correct | 1 ms | 344 KB | Output is correct |
17 | Correct | 1 ms | 344 KB | Output is correct |
18 | Correct | 1 ms | 344 KB | Output is correct |
19 | Correct | 1 ms | 348 KB | Output is correct |
20 | Correct | 0 ms | 432 KB | Output is correct |
21 | Correct | 2 ms | 344 KB | Output is correct |
22 | Correct | 1 ms | 344 KB | Output is correct |
23 | Correct | 1 ms | 348 KB | Output is correct |
24 | Correct | 1 ms | 348 KB | Output is correct |
25 | Correct | 2 ms | 348 KB | Output is correct |
26 | Correct | 3 ms | 348 KB | Output is correct |
27 | Correct | 6 ms | 488 KB | Output is correct |
28 | Correct | 9 ms | 528 KB | Output is correct |
29 | Correct | 8 ms | 348 KB | Output is correct |
30 | Correct | 1 ms | 348 KB | Output is correct |
31 | Correct | 6 ms | 484 KB | Output is correct |
32 | Correct | 7 ms | 344 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 1 ms | 344 KB | Output is correct |
7 | Correct | 1 ms | 348 KB | Output is correct |
8 | Correct | 0 ms | 436 KB | Output is correct |
9 | Correct | 0 ms | 348 KB | Output is correct |
10 | Correct | 1 ms | 348 KB | Output is correct |
11 | Correct | 0 ms | 348 KB | Output is correct |
12 | Correct | 0 ms | 436 KB | Output is correct |
13 | Correct | 1 ms | 348 KB | Output is correct |
14 | Correct | 1 ms | 348 KB | Output is correct |
15 | Correct | 0 ms | 356 KB | Output is correct |
16 | Correct | 1 ms | 348 KB | Output is correct |
17 | Correct | 0 ms | 348 KB | Output is correct |
18 | Correct | 1 ms | 344 KB | Output is correct |
19 | Correct | 0 ms | 348 KB | Output is correct |
20 | Correct | 0 ms | 348 KB | Output is correct |
21 | Correct | 1 ms | 344 KB | Output is correct |
22 | Correct | 1 ms | 344 KB | Output is correct |
23 | Correct | 1 ms | 348 KB | Output is correct |
24 | Correct | 0 ms | 348 KB | Output is correct |
25 | Correct | 1 ms | 344 KB | Output is correct |
26 | Correct | 1 ms | 348 KB | Output is correct |
27 | Correct | 0 ms | 348 KB | Output is correct |
28 | Correct | 0 ms | 348 KB | Output is correct |
29 | Correct | 0 ms | 348 KB | Output is correct |
30 | Correct | 1 ms | 348 KB | Output is correct |
31 | Correct | 0 ms | 348 KB | Output is correct |
32 | Correct | 0 ms | 348 KB | Output is correct |
33 | Correct | 1 ms | 440 KB | Output is correct |
34 | Correct | 1 ms | 348 KB | Output is correct |
35 | Correct | 0 ms | 348 KB | Output is correct |
36 | Correct | 1 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 | 348 KB | Output is correct |
40 | Correct | 1 ms | 348 KB | Output is correct |
41 | Correct | 2 ms | 348 KB | Output is correct |
42 | Correct | 1 ms | 348 KB | Output is correct |
43 | Correct | 0 ms | 432 KB | Output is correct |
44 | Correct | 1 ms | 348 KB | Output is correct |
45 | Correct | 1 ms | 356 KB | Output is correct |
46 | Correct | 1 ms | 356 KB | Output is correct |
47 | Correct | 1 ms | 348 KB | Output is correct |
48 | Correct | 1 ms | 348 KB | Output is correct |
49 | Correct | 4 ms | 348 KB | Output is correct |
50 | Correct | 6 ms | 348 KB | Output is correct |
51 | Correct | 8 ms | 348 KB | Output is correct |
52 | Correct | 8 ms | 528 KB | Output is correct |
53 | Correct | 0 ms | 348 KB | Output is correct |
54 | Correct | 8 ms | 348 KB | Output is correct |
55 | Correct | 8 ms | 508 KB | Output is correct |
56 | Correct | 1 ms | 348 KB | Output is correct |
57 | Correct | 2 ms | 348 KB | Output is correct |
58 | Correct | 3 ms | 348 KB | Output is correct |
59 | Correct | 4 ms | 344 KB | Output is correct |
60 | Correct | 4 ms | 348 KB | Output is correct |
61 | Correct | 1 ms | 436 KB | Output is correct |
62 | Correct | 4 ms | 348 KB | Output is correct |
63 | Correct | 5 ms | 348 KB | Output is correct |
64 | Correct | 10 ms | 524 KB | Output is correct |
65 | Correct | 1 ms | 352 KB | Output is correct |
66 | Correct | 1 ms | 348 KB | Output is correct |
67 | Correct | 1 ms | 436 KB | Output is correct |
68 | Correct | 3 ms | 348 KB | Output is correct |
69 | Correct | 4 ms | 348 KB | Output is correct |
70 | Correct | 4 ms | 428 KB | Output is correct |
71 | Correct | 1 ms | 348 KB | Output is correct |
72 | Correct | 4 ms | 524 KB | Output is correct |
73 | Correct | 4 ms | 344 KB | Output is correct |
74 | Correct | 4 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 1 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 | 1 ms | 348 KB | Output is correct |
7 | Correct | 0 ms | 348 KB | Output is correct |
8 | Correct | 0 ms | 348 KB | Output is correct |
9 | Correct | 0 ms | 348 KB | Output is correct |
10 | Correct | 0 ms | 348 KB | Output is correct |
11 | Correct | 1 ms | 348 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 | 688 KB | Output is correct |
15 | Correct | 0 ms | 344 KB | Output is correct |
16 | Correct | 1 ms | 348 KB | Output is correct |
17 | Correct | 0 ms | 348 KB | Output is correct |
18 | Correct | 1 ms | 348 KB | Output is correct |
19 | Correct | 0 ms | 348 KB | Output is correct |
20 | Correct | 1 ms | 348 KB | Output is correct |
21 | Correct | 1 ms | 344 KB | Output is correct |
22 | Correct | 1 ms | 348 KB | Output is correct |
23 | Correct | 1 ms | 348 KB | Output is correct |
24 | Correct | 1 ms | 348 KB | Output is correct |
25 | Correct | 1 ms | 348 KB | Output is correct |
26 | Correct | 1 ms | 344 KB | Output is correct |
27 | Correct | 1 ms | 348 KB | Output is correct |
28 | Correct | 1 ms | 436 KB | Output is correct |
29 | Correct | 2 ms | 348 KB | Output is correct |
30 | Correct | 1 ms | 348 KB | Output is correct |
31 | Correct | 2 ms | 348 KB | Output is correct |
32 | Correct | 1 ms | 436 KB | Output is correct |
33 | Correct | 1 ms | 348 KB | Output is correct |
34 | Correct | 2 ms | 344 KB | Output is correct |
35 | Correct | 1 ms | 344 KB | Output is correct |
36 | Correct | 3 ms | 344 KB | Output is correct |
37 | Correct | 6 ms | 532 KB | Output is correct |
38 | Correct | 9 ms | 348 KB | Output is correct |
39 | Correct | 8 ms | 348 KB | Output is correct |
40 | Correct | 0 ms | 432 KB | Output is correct |
41 | Correct | 7 ms | 348 KB | Output is correct |
42 | Correct | 7 ms | 348 KB | Output is correct |
43 | Correct | 1 ms | 348 KB | Output is correct |
44 | Correct | 2 ms | 348 KB | Output is correct |
45 | Correct | 3 ms | 348 KB | Output is correct |
46 | Correct | 4 ms | 348 KB | Output is correct |
47 | Correct | 4 ms | 600 KB | Output is correct |
48 | Correct | 1 ms | 344 KB | Output is correct |
49 | Correct | 5 ms | 348 KB | Output is correct |
50 | Correct | 5 ms | 348 KB | Output is correct |
51 | Correct | 2 ms | 348 KB | Output is correct |
52 | Correct | 213 ms | 940 KB | Output is correct |
53 | Execution timed out | 1055 ms | 4952 KB | Time limit exceeded |
54 | Halted | 0 ms | 0 KB | - |