Submission #244196

#TimeUsernameProblemLanguageResultExecution timeMemory
244196jovan_bBali Sculptures (APIO15_sculpture)C++17
0 / 100
5 ms384 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; ll dp[2005][2005]; ll niz[2005]; const ll INF = 1000000000000000LL; int main(){ ios_base::sync_with_stdio(false), cin.tie(0); cout.precision(10); cout << fixed; int n, a, b; cin >> n >> a >> b; for(int i=1; i<=b; i++) dp[0][i] = INF; for(int i=1; i<=n; i++){ cin >> niz[i]; for(int j=0; j<=b; j++) dp[i][j] = INF; ll sum = 0; for(int j=i; j>=1; j--){ sum += niz[j]; for(int k=1; k<=b; k++) dp[i][k] = min(dp[i][k], dp[j-1][k-1] | sum); } } ll res = dp[n][b]; for(int i=a; i<=b; i++) res = min(res, dp[n][i]); cout << dp[n][b] << "\n"; return 0; } /* 6 1 3 8 1 2 1 5 4 */
#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...