# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
916203 | 2024-01-25T13:14:38 Z | hariaakas646 | Bali Sculptures (APIO15_sculpture) | C++17 | 249 ms | 604 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); } bool dp[21][51][513] = {false}; 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-1]); // dp[0][0][0] = true; // frange(i, b) { // forr(j, 0, n+1) { // frange(k, 513) { // if(dp[i][j][k]) { // int v = 0; // forr(l, j+1, n+1) { // v += vec[l]; // dp[i+1][l][k | v] = true; // } // } // } // } // } lli mi = 1e18; // forr(i, a, b+1) { // frange(k, 513) { // if(dp[i][n][k]) mi = min(mi, k); // } // } forr(i, 1, 1<<n) { if(a <= __builtin_popcount(i) && __builtin_popcount(i) <= b && (i & (1<<(n-1)))) { lli tot = 0; lli v = 0; frange(j, n) { v += vec[j]; if(i & (1<<j)) { tot = tot | v; v = 0; } } mi = min(mi, tot); } } printf("%lld", mi); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 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 | 348 KB | Output is correct |
5 | Correct | 1 ms | 348 KB | Output is correct |
6 | Correct | 1 ms | 348 KB | Output is correct |
7 | Correct | 1 ms | 348 KB | Output is correct |
8 | Correct | 3 ms | 348 KB | Output is correct |
9 | Correct | 3 ms | 348 KB | Output is correct |
10 | Correct | 3 ms | 348 KB | Output is correct |
11 | Correct | 3 ms | 348 KB | Output is correct |
12 | Correct | 3 ms | 348 KB | Output is correct |
13 | Correct | 36 ms | 348 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 | 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 | 7 ms | 348 KB | Output is correct |
22 | Correct | 6 ms | 440 KB | Output is correct |
23 | Correct | 6 ms | 344 KB | Output is correct |
24 | Correct | 3 ms | 348 KB | Output is correct |
25 | Correct | 6 ms | 348 KB | Output is correct |
26 | Correct | 32 ms | 348 KB | Output is correct |
27 | Correct | 0 ms | 600 KB | Output is correct |
28 | Correct | 0 ms | 348 KB | Output is correct |
29 | Correct | 1 ms | 348 KB | Output is correct |
30 | Correct | 2 ms | 600 KB | Output is correct |
31 | Correct | 6 ms | 348 KB | Output is correct |
32 | Correct | 3 ms | 344 KB | Output is correct |
33 | Correct | 31 ms | 348 KB | Output is correct |
34 | Correct | 36 ms | 412 KB | Output is correct |
35 | Correct | 3 ms | 348 KB | Output is correct |
36 | Correct | 34 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 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 | 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 | 1 ms | 348 KB | Output is correct |
8 | Correct | 3 ms | 348 KB | Output is correct |
9 | Correct | 3 ms | 348 KB | Output is correct |
10 | Correct | 3 ms | 348 KB | Output is correct |
11 | Correct | 3 ms | 348 KB | Output is correct |
12 | Correct | 3 ms | 344 KB | Output is correct |
13 | Correct | 34 ms | 344 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 | 348 KB | Output is correct |
18 | Correct | 0 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 | 5 ms | 440 KB | Output is correct |
22 | Correct | 8 ms | 604 KB | Output is correct |
23 | Correct | 5 ms | 348 KB | Output is correct |
24 | Correct | 3 ms | 348 KB | Output is correct |
25 | Correct | 6 ms | 348 KB | Output is correct |
26 | Correct | 31 ms | 344 KB | Output is correct |
27 | Correct | 72 ms | 348 KB | Output is correct |
28 | Correct | 249 ms | 416 KB | Output is correct |
29 | Incorrect | 0 ms | 344 KB | Output isn't correct |
30 | Halted | 0 ms | 0 KB | - |
# | 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 | 1 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 | 348 KB | Output is correct |
7 | Correct | 1 ms | 348 KB | Output is correct |
8 | Correct | 3 ms | 348 KB | Output is correct |
9 | Correct | 3 ms | 348 KB | Output is correct |
10 | Correct | 4 ms | 344 KB | Output is correct |
11 | Correct | 3 ms | 348 KB | Output is correct |
12 | Correct | 3 ms | 344 KB | Output is correct |
13 | Correct | 34 ms | 344 KB | Output is correct |
14 | Correct | 72 ms | 348 KB | Output is correct |
15 | Correct | 248 ms | 412 KB | Output is correct |
16 | Incorrect | 0 ms | 344 KB | Output isn't correct |
17 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 500 KB | Output is correct |
3 | Correct | 1 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 | 348 KB | Output is correct |
7 | Correct | 1 ms | 344 KB | Output is correct |
8 | Correct | 3 ms | 348 KB | Output is correct |
9 | Correct | 3 ms | 348 KB | Output is correct |
10 | Correct | 3 ms | 348 KB | Output is correct |
11 | Correct | 3 ms | 348 KB | Output is correct |
12 | Correct | 3 ms | 436 KB | Output is correct |
13 | Correct | 35 ms | 348 KB | Output is correct |
14 | Correct | 1 ms | 344 KB | Output is correct |
15 | Correct | 0 ms | 344 KB | Output is correct |
16 | Correct | 0 ms | 348 KB | Output is correct |
17 | Correct | 1 ms | 348 KB | Output is correct |
18 | Correct | 0 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 | 5 ms | 440 KB | Output is correct |
22 | Correct | 5 ms | 436 KB | Output is correct |
23 | Correct | 5 ms | 348 KB | Output is correct |
24 | Correct | 3 ms | 348 KB | Output is correct |
25 | Correct | 7 ms | 348 KB | Output is correct |
26 | Correct | 30 ms | 348 KB | Output is correct |
27 | Correct | 0 ms | 344 KB | Output is correct |
28 | Correct | 1 ms | 348 KB | Output is correct |
29 | Correct | 1 ms | 348 KB | Output is correct |
30 | Correct | 2 ms | 348 KB | Output is correct |
31 | Correct | 6 ms | 344 KB | Output is correct |
32 | Correct | 3 ms | 344 KB | Output is correct |
33 | Correct | 31 ms | 348 KB | Output is correct |
34 | Correct | 36 ms | 348 KB | Output is correct |
35 | Correct | 3 ms | 348 KB | Output is correct |
36 | Correct | 35 ms | 348 KB | Output is correct |
37 | Correct | 70 ms | 420 KB | Output is correct |
38 | Correct | 243 ms | 416 KB | Output is correct |
39 | Incorrect | 0 ms | 344 KB | Output isn't correct |
40 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 1 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 348 KB | Output is correct |
5 | Correct | 1 ms | 600 KB | Output is correct |
6 | Correct | 1 ms | 348 KB | Output is correct |
7 | Correct | 1 ms | 348 KB | Output is correct |
8 | Correct | 3 ms | 344 KB | Output is correct |
9 | Correct | 3 ms | 348 KB | Output is correct |
10 | Correct | 3 ms | 440 KB | Output is correct |
11 | Correct | 3 ms | 348 KB | Output is correct |
12 | Correct | 3 ms | 348 KB | Output is correct |
13 | Correct | 36 ms | 348 KB | Output is correct |
14 | Correct | 1 ms | 348 KB | Output is correct |
15 | Correct | 1 ms | 348 KB | Output is correct |
16 | Correct | 1 ms | 344 KB | Output is correct |
17 | Correct | 1 ms | 348 KB | Output is correct |
18 | Correct | 5 ms | 444 KB | Output is correct |
19 | Correct | 3 ms | 348 KB | Output is correct |
20 | Correct | 30 ms | 348 KB | Output is correct |
21 | Correct | 36 ms | 348 KB | Output is correct |
22 | Correct | 4 ms | 344 KB | Output is correct |
23 | Correct | 35 ms | 596 KB | Output is correct |
24 | Correct | 69 ms | 344 KB | Output is correct |
25 | Correct | 243 ms | 420 KB | Output is correct |
26 | Incorrect | 1 ms | 348 KB | Output isn't correct |
27 | Halted | 0 ms | 0 KB | - |