Submission #523215

# Submission time Handle Problem Language Result Execution time Memory
523215 2022-02-07T08:14:30 Z vonatlus Bali Sculptures (APIO15_sculpture) C++17
9 / 100
229 ms 332 KB
/// adil sultanov | vonat1us 

#pragma GCC optimize("O3")
//#pragma comment(linker, "/STACK:36777216")

#include<bits/stdc++.h>

#define x first
#define y second
#define pb push_back
#define sz(x) (int) x.size()
#define all(z) (z).begin(), (z).end()
 
using namespace std;

using ll = long long;
using pii = pair<int, int>;                                   

const int MOD = 1e9 + 7; 
const int INF = 1e9 + 1e2;
  
void fin() {
#ifdef AM
    freopen(".in", "r", stdin);
#endif        
}                   

const bool flag = 0;

const int N = 2e3+10;

void ma1n() {
    int n, L, R;
    cin >> n >> L >> R;
    vector<ll> a(n);
    for (ll& x : a) cin >> x;
    ll ans = (1ll<<50);
    for (int mask = 0; mask < (1<<(n-1)); ++mask) {
        int cnt = __builtin_popcount(mask)+1;
        if (cnt < L || cnt > R) continue;
        ll res = 0, sum = 0;
        for (int i = 0; i < n; ++i) {
            sum += a[i];
            if (i == n-1 || mask>>i&1) {
                res |= sum;
                sum = 0;
            }
        }
        ans = min(ans, res);
    }
    cout << ans;
} 

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(nullptr), fin();
    int ts = 1;
    if (flag) {
        cin >> ts;
    }
    while (ts--) {
        ma1n(); 
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 2 ms 204 KB Output is correct
9 Correct 2 ms 204 KB Output is correct
10 Correct 2 ms 204 KB Output is correct
11 Correct 2 ms 204 KB Output is correct
12 Correct 2 ms 204 KB Output is correct
13 Correct 32 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 0 ms 204 KB Output is correct
16 Correct 0 ms 204 KB Output is correct
17 Correct 0 ms 204 KB Output is correct
18 Correct 0 ms 204 KB Output is correct
19 Correct 0 ms 204 KB Output is correct
20 Correct 1 ms 204 KB Output is correct
21 Correct 7 ms 204 KB Output is correct
22 Correct 4 ms 204 KB Output is correct
23 Correct 6 ms 204 KB Output is correct
24 Correct 2 ms 312 KB Output is correct
25 Correct 4 ms 204 KB Output is correct
26 Correct 30 ms 204 KB Output is correct
27 Correct 1 ms 204 KB Output is correct
28 Correct 1 ms 204 KB Output is correct
29 Correct 1 ms 312 KB Output is correct
30 Correct 1 ms 204 KB Output is correct
31 Correct 4 ms 308 KB Output is correct
32 Correct 2 ms 204 KB Output is correct
33 Correct 29 ms 308 KB Output is correct
34 Correct 31 ms 204 KB Output is correct
35 Correct 2 ms 204 KB Output is correct
36 Correct 39 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 2 ms 204 KB Output is correct
9 Correct 2 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 2 ms 204 KB Output is correct
12 Correct 2 ms 204 KB Output is correct
13 Correct 34 ms 300 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 0 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 0 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 1 ms 204 KB Output is correct
21 Correct 5 ms 204 KB Output is correct
22 Correct 5 ms 204 KB Output is correct
23 Correct 6 ms 204 KB Output is correct
24 Correct 2 ms 204 KB Output is correct
25 Correct 4 ms 308 KB Output is correct
26 Correct 30 ms 204 KB Output is correct
27 Correct 64 ms 288 KB Output is correct
28 Correct 229 ms 204 KB Output is correct
29 Incorrect 1 ms 204 KB Output isn't correct
30 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 2 ms 204 KB Output is correct
9 Correct 2 ms 204 KB Output is correct
10 Correct 2 ms 204 KB Output is correct
11 Correct 3 ms 204 KB Output is correct
12 Correct 2 ms 204 KB Output is correct
13 Correct 36 ms 296 KB Output is correct
14 Correct 66 ms 204 KB Output is correct
15 Correct 217 ms 204 KB Output is correct
16 Incorrect 0 ms 204 KB Output isn't correct
17 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 224 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 2 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 2 ms 204 KB Output is correct
9 Correct 2 ms 204 KB Output is correct
10 Correct 2 ms 204 KB Output is correct
11 Correct 2 ms 204 KB Output is correct
12 Correct 2 ms 204 KB Output is correct
13 Correct 34 ms 284 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 0 ms 204 KB Output is correct
17 Correct 0 ms 204 KB Output is correct
18 Correct 0 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 0 ms 204 KB Output is correct
21 Correct 7 ms 204 KB Output is correct
22 Correct 5 ms 204 KB Output is correct
23 Correct 4 ms 204 KB Output is correct
24 Correct 2 ms 204 KB Output is correct
25 Correct 5 ms 204 KB Output is correct
26 Correct 30 ms 204 KB Output is correct
27 Correct 1 ms 204 KB Output is correct
28 Correct 0 ms 204 KB Output is correct
29 Correct 1 ms 204 KB Output is correct
30 Correct 1 ms 204 KB Output is correct
31 Correct 6 ms 204 KB Output is correct
32 Correct 2 ms 204 KB Output is correct
33 Correct 29 ms 204 KB Output is correct
34 Correct 36 ms 304 KB Output is correct
35 Correct 2 ms 204 KB Output is correct
36 Correct 36 ms 204 KB Output is correct
37 Correct 66 ms 292 KB Output is correct
38 Correct 217 ms 288 KB Output is correct
39 Incorrect 1 ms 204 KB Output isn't correct
40 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 2 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 2 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 2 ms 204 KB Output is correct
11 Correct 2 ms 204 KB Output is correct
12 Correct 2 ms 204 KB Output is correct
13 Correct 39 ms 304 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 4 ms 204 KB Output is correct
19 Correct 2 ms 308 KB Output is correct
20 Correct 31 ms 312 KB Output is correct
21 Correct 34 ms 204 KB Output is correct
22 Correct 3 ms 204 KB Output is correct
23 Correct 32 ms 288 KB Output is correct
24 Correct 64 ms 204 KB Output is correct
25 Correct 220 ms 296 KB Output is correct
26 Incorrect 1 ms 204 KB Output isn't correct
27 Halted 0 ms 0 KB -