Submission #248978

# Submission time Handle Problem Language Result Execution time Memory
248978 2020-07-13T19:52:59 Z rocks03 Bali Sculptures (APIO15_sculpture) C++14
21 / 100
23 ms 34944 KB
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<ll,ll>
#define ff first
#define ss second
#define pb push_back
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int MAXN = 2e3+100;
int N, A, B;
ll a[MAXN], DP[MAXN+1][MAXN+1];

ll f(int pos, int gruppo){
    if(pos == N){
        if(gruppo < A || gruppo > B)
            return LLONG_MAX;
        return 0;
    }
    if(DP[pos][gruppo] != -1) return DP[pos][gruppo];
    ll sum = 0, best = LLONG_MAX, res;
    for(int i = pos; i < N; i++){
        sum += a[i];
        res = f(i+1, gruppo+1);
        best = min(best, (sum|res));
    }
    return DP[pos][gruppo] = best;
}

main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> N >> A >> B;
    for(int i = 0; i < N; i++) cin >> a[i];
    memset(DP, -1, sizeof(DP));
    cout << f(0, 0);
}

Compilation message

sculpture.cpp:30:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main(){
      ^
# Verdict Execution time Memory Grader output
1 Correct 16 ms 34944 KB Output is correct
2 Correct 16 ms 34944 KB Output is correct
3 Correct 16 ms 34944 KB Output is correct
4 Correct 17 ms 34936 KB Output is correct
5 Correct 21 ms 34944 KB Output is correct
6 Correct 16 ms 34944 KB Output is correct
7 Correct 22 ms 34936 KB Output is correct
8 Correct 16 ms 34944 KB Output is correct
9 Correct 16 ms 34944 KB Output is correct
10 Correct 16 ms 34944 KB Output is correct
11 Correct 16 ms 34944 KB Output is correct
12 Correct 16 ms 34944 KB Output is correct
13 Correct 16 ms 34944 KB Output is correct
14 Correct 16 ms 34944 KB Output is correct
15 Correct 17 ms 34872 KB Output is correct
16 Correct 16 ms 34944 KB Output is correct
17 Correct 16 ms 34944 KB Output is correct
18 Correct 16 ms 34944 KB Output is correct
19 Correct 16 ms 34944 KB Output is correct
20 Correct 16 ms 34944 KB Output is correct
21 Incorrect 16 ms 34944 KB Output isn't correct
22 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 16 ms 34944 KB Output is correct
2 Correct 16 ms 34944 KB Output is correct
3 Correct 18 ms 34944 KB Output is correct
4 Correct 16 ms 34944 KB Output is correct
5 Correct 16 ms 34944 KB Output is correct
6 Correct 16 ms 34944 KB Output is correct
7 Correct 16 ms 34944 KB Output is correct
8 Correct 16 ms 34944 KB Output is correct
9 Correct 16 ms 34944 KB Output is correct
10 Correct 16 ms 34940 KB Output is correct
11 Correct 16 ms 34944 KB Output is correct
12 Correct 16 ms 34944 KB Output is correct
13 Correct 17 ms 34944 KB Output is correct
14 Correct 16 ms 34944 KB Output is correct
15 Correct 17 ms 34944 KB Output is correct
16 Correct 16 ms 34944 KB Output is correct
17 Correct 16 ms 34944 KB Output is correct
18 Correct 16 ms 34944 KB Output is correct
19 Correct 16 ms 34920 KB Output is correct
20 Correct 16 ms 34944 KB Output is correct
21 Incorrect 16 ms 34944 KB Output isn't correct
22 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 20 ms 34944 KB Output is correct
2 Correct 16 ms 34944 KB Output is correct
3 Correct 16 ms 34944 KB Output is correct
4 Correct 16 ms 34944 KB Output is correct
5 Correct 17 ms 34944 KB Output is correct
6 Correct 16 ms 34944 KB Output is correct
7 Correct 16 ms 34944 KB Output is correct
8 Correct 16 ms 34944 KB Output is correct
9 Correct 18 ms 34944 KB Output is correct
10 Correct 17 ms 34900 KB Output is correct
11 Correct 16 ms 34944 KB Output is correct
12 Correct 16 ms 34944 KB Output is correct
13 Correct 16 ms 34944 KB Output is correct
14 Correct 17 ms 34944 KB Output is correct
15 Correct 17 ms 34848 KB Output is correct
16 Correct 16 ms 34944 KB Output is correct
17 Correct 16 ms 34944 KB Output is correct
18 Correct 16 ms 34944 KB Output is correct
19 Correct 16 ms 34944 KB Output is correct
20 Correct 18 ms 34944 KB Output is correct
21 Correct 16 ms 34944 KB Output is correct
22 Correct 18 ms 34944 KB Output is correct
23 Correct 16 ms 34944 KB Output is correct
24 Correct 16 ms 34816 KB Output is correct
25 Correct 17 ms 34944 KB Output is correct
26 Correct 16 ms 34944 KB Output is correct
27 Correct 17 ms 34944 KB Output is correct
28 Correct 17 ms 34944 KB Output is correct
29 Correct 17 ms 34944 KB Output is correct
30 Correct 17 ms 34944 KB Output is correct
31 Correct 18 ms 34944 KB Output is correct
32 Correct 20 ms 34944 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 16 ms 34936 KB Output is correct
2 Correct 16 ms 34944 KB Output is correct
3 Correct 17 ms 34944 KB Output is correct
4 Correct 16 ms 34944 KB Output is correct
5 Correct 16 ms 34816 KB Output is correct
6 Correct 16 ms 34944 KB Output is correct
7 Correct 16 ms 34944 KB Output is correct
8 Correct 18 ms 34944 KB Output is correct
9 Correct 16 ms 34944 KB Output is correct
10 Correct 16 ms 34944 KB Output is correct
11 Correct 19 ms 34944 KB Output is correct
12 Correct 16 ms 34936 KB Output is correct
13 Correct 16 ms 34944 KB Output is correct
14 Correct 16 ms 34944 KB Output is correct
15 Correct 16 ms 34944 KB Output is correct
16 Correct 16 ms 34944 KB Output is correct
17 Correct 16 ms 34944 KB Output is correct
18 Correct 16 ms 34816 KB Output is correct
19 Correct 17 ms 34944 KB Output is correct
20 Correct 16 ms 34936 KB Output is correct
21 Incorrect 17 ms 34944 KB Output isn't correct
22 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 16 ms 34944 KB Output is correct
2 Correct 16 ms 34944 KB Output is correct
3 Correct 17 ms 34944 KB Output is correct
4 Correct 22 ms 34944 KB Output is correct
5 Correct 23 ms 34944 KB Output is correct
6 Correct 16 ms 34944 KB Output is correct
7 Correct 22 ms 34944 KB Output is correct
8 Correct 16 ms 34944 KB Output is correct
9 Correct 17 ms 34944 KB Output is correct
10 Correct 16 ms 34880 KB Output is correct
11 Correct 16 ms 34944 KB Output is correct
12 Correct 16 ms 34944 KB Output is correct
13 Correct 16 ms 34936 KB Output is correct
14 Correct 16 ms 34944 KB Output is correct
15 Correct 16 ms 34944 KB Output is correct
16 Correct 16 ms 34900 KB Output is correct
17 Correct 16 ms 34944 KB Output is correct
18 Incorrect 16 ms 34944 KB Output isn't correct
19 Halted 0 ms 0 KB -