Submission #106603

#TimeUsernameProblemLanguageResultExecution timeMemory
106603abilBali Sculptures (APIO15_sculpture)C++14
0 / 100
32 ms31872 KiB
#include <bits/stdc++.h> #define mk make_pair #define sc second #define fr first #define pb emplace_back #define all(s) s.begin(), s.end() #define sz(s) ( (int)s.size() ) #define int long long using namespace std; const int inf = (int)1e9 + 7 ; const long long mod = 1e9 + 7; const int N = (int)2007; int n, arr[N], a, b, dp[N][N], ans = inf,pr[N]; main(){ memset(dp,0x3f3f3f3f,sizeof(dp)); dp[0][1] = 0; cin >> n >> a >> b; for(int i = 1;i <= n; i++){ cin >> arr[i]; pr[i] = pr[i - 1] + arr[i]; dp[i][1] = dp[i - 1][1] + arr[i]; } for(int g = 2;g <= b; g++){ for(int i = 2;i <= n; i++){ for(int j = 2;j < i; j++){ dp[i][g] = min(dp[i][g], dp[j - 1][g - 1] | (pr[i] - pr[j - 1])); } } } for(int i = a;i <= b; i++){ //cout << dp[n][i] << " "; ans = min(ans,dp[n][i]); } cout << ans; } /* 6 1 3 8 1 2 1 5 4 */

Compilation message (stderr)

sculpture.cpp:18: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...