# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
41518 | wzy | Bali Sculptures (APIO15_sculpture) | C++14 | 41 ms | 49668 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
long long y[2500] , dp[2500][2500] , dp2[105][105];
long long n , a ,b;
long long solve(long long i , long long j){
if(i == n + 1){
if(j >= a && j <= b) return 0;
else return ((1LL<<31) - 1);
}
if(dp[i][j] != -1) return dp[i][j];
dp[i][j] = (long long) 1e18;
for(int w = i ; w <= n; w++){
dp[i][j] = min((solve(w + 1 , j + 1) )|(y[w] - y[i-1]) , dp[i][j]);
}
return dp[i][j];
}
int main(){
scanf("%lld%lld%lld" , &n , &a , &b);
y[0] = 0;
for(int i = 1 ; i <= n; i++){
scanf("%lld" , & y[i]);
y[i] += y[i-1];
}
memset(dp, -1 , sizeof dp);
printf("%lld\n" , solve(1,1));
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |