Submission #243328

# Submission time Handle Problem Language Result Execution time Memory
243328 2020-06-30T23:00:56 Z Leonardo_Paes Bali Sculptures (APIO15_sculpture) C++17
0 / 100
5 ms 512 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
inline bool check(ll a, ll b){
    return ((a&b) == a);
}
int32_t main(){
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    int n, a, b;
    cin >> n >> a >> b;
    vector<int> v(n+1);
    for(int i=1; i<=n; i++) cin >> v[i];
    if(a == 1){
        vector<int> dp(n+1); // least k | it is possible to divide in k subarrays
        ll mask = ~(1LL<<63);
        for(int i=62; i>=0; i--){
            dp[0] = 0;
            for(int x=1; x<=n; x++) dp[x] = n+1;
            for(int x=1; x<=n; x++){
                ll sum = 0;
                for(int y=x; y>=1; y--){
                    sum += v[y];
                    if(check(sum, mask^(1<<i))) dp[x] = min(dp[x], 1 + dp[y-1]);
                }
            }
            if(dp[n] <= b) mask ^= (1<<i);
        }
        cout << mask << "\n";
    }
    else{

    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 512 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -