Submission #985506

#TimeUsernameProblemLanguageResultExecution timeMemory
985506muratcepedaBali Sculptures (APIO15_sculpture)C++17
0 / 100
1 ms504 KiB
#include <bits/stdc++.h> using namespace std; #define lli long long int #define rep(i, a, b) for(int i = a; i <= b; i++) #define MAX 100 #define MAXM lli n, a, b, y[MAX + 3], dp[MAX + 3][MAX + 3]; int main(){ cin >> n >> a >> b; rep(i, 1, n){ cin >> y[i]; if(i > 1) dp[1][i] = y[i] + dp[1][i - 1]; else dp[1][i] = y[i]; } rep(fil, 2, b){ rep(col, 1, n) dp[fil][col] = (1ll << 62); } rep(fil, 2, b){ rep(col, fil, n){ lli suma = y[col]; for(int i = col - 1; i >= fil - 1; --i){ dp[fil][col] = min(dp[fil][col], suma | dp[fil - 1][i]); suma += y[i]; } } } lli res = (1ll << 62); rep(i, a, b){ res = min(res, dp[i][n]); } cout << res; return 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...