Submission #104561

#TimeUsernameProblemLanguageResultExecution timeMemory
104561HideoBali Sculptures (APIO15_sculpture)C++14
0 / 100
3 ms432 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define pb push_back #define mk make_pair #define fr first #define sc second #define vi vector < int > #define vl vector < ll > #define pi pair < int, int > #define pii pair < int, pi > #define vii vector < pi > const int N = 107; const int INF = 1e9 + 7; int c[N], pr[N], dp[N][N]; int n, a, b; main(){ cin >> n >> a >> b; for (int i = 1; i <= n; i++){ cin >> c[i]; pr[i] = c[i] + pr[i - 1]; fill(dp[i], dp[i] + N, INF); } for (int i = 1; i <= n; i++){ for (int j = 1; j <= min(i, b); j++){ if (j > 1){ for (int k = j; k <= i; k++){ dp[i][j] = min(dp[i][j], (dp[k - 1][j - 1] | (pr[i] - pr[k - 1]))); } } else dp[i][j] = pr[i]; } } int mn = INF; for (int i = a; i <= b; i++){ mn = min(mn, dp[n][i]); } cout << mn; }

Compilation message (stderr)

sculpture.cpp:21:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main(){
      ^
#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...