Submission #125886

# Submission time Handle Problem Language Result Execution time Memory
125886 2019-07-06T13:48:22 Z jakob_nogler Bali Sculptures (APIO15_sculpture) C++14
0 / 100
2 ms 380 KB
#include <bits/stdc++.h>

using namespace std;

typedef vector<int> vi;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n, a, b;
    cin >> n >> a >> b;
    vi val(n);
    for(int i = 0; i < n; i++)
        cin >> val[i];

    int curr = 0;
    for(int i = 30; i >= 0; i--){
        vi cnt(n + 1, n);

        cnt[0] = 1;
        for(int j = 0; j < n; j++){
            int sum = 0;
            for(int k = j; k < n; k++){
                sum += val[k];

                if(((sum >> i) | (curr >> i)) == (curr >> i))
                    cnt[k + 1] = min(cnt[k + 1], cnt[j] + 1);
            }
        }

        if(cnt[n] > b)
            curr |= (1 << i);
    }

    cout << curr << endl;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Incorrect 2 ms 376 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Incorrect 2 ms 376 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 380 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Incorrect 2 ms 380 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Incorrect 2 ms 376 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 252 KB Output is correct
5 Incorrect 2 ms 376 KB Output isn't correct
6 Halted 0 ms 0 KB -