Submission #40488

#TimeUsernameProblemLanguageResultExecution timeMemory
40488WaschbarBali Sculptures (APIO15_sculpture)C++14
0 / 100
2 ms604 KiB
#include <bits/stdc++.h> #define st first #define nd second using namespace std; const long long INF = 1e12; const int MOD = 1e9+7; const int MAXN = 30000; int n, l, r; long long v[200], sum[200]; long long dp[200][200]; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cin >> n >> l >> r; long long sm = 0; for(int i = 0; i <= n; i++) for(int j = 0; j <= n; j++) dp[i][j] = INF; for(int i = 1; i <= n; i++) { cin >> v[i]; sm += v[i]; sum[i] = sm; dp[i][1] = sm; } for(int i = 2; i <= n; i++) for(int k = 2; k <= i; k++){ for(int j = i-1; j > 0; j--) dp[i][k] = min(dp[i][k],dp[j][k-1]|(sum[i]-sum[j])); } long long ans = INF; for(int i = l; i <= r; i++) ans = min(ans,dp[n][i]); cout << ans; }
#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...