Submission #918217

#TimeUsernameProblemLanguageResultExecution timeMemory
918217IrateBali Sculptures (APIO15_sculpture)C++14
21 / 100
1 ms600 KiB
#include<bits/stdc++.h> using namespace std; const int mxN = 105; long long dp[mxN][mxN]; int a, b, n; vector<int>v; long long rec(int indx, int x){ long long res = 1e15, sum = 0; if(indx == n && x >= a && x <= b)return 0; if(indx == n)return 1e15; if(dp[indx][x] != -1)return dp[indx][x]; for(int i = indx;i < n;++i){ sum += v[i]; res = min(res, sum | rec(i + 1, x + 1)); } return dp[indx][x] = res; } int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cin >> n >> a >> b; v.resize(n); for(int i = 0;i < mxN;++i){ for(int j = 0;j < mxN;++j){ dp[i][j] = -1; } } for(int i = 0;i < n;++i){ cin >> v[i]; } cout << rec(0, 0); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...