Submission #106603

# Submission time Handle Problem Language Result Execution time Memory
106603 2019-04-19T07:40:49 Z abil Bali Sculptures (APIO15_sculpture) C++14
0 / 100
32 ms 31872 KB
#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

sculpture.cpp:18:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main(){
      ^
# Verdict Execution time Memory Grader output
1 Correct 32 ms 31872 KB Output is correct
2 Incorrect 26 ms 31872 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 31 ms 31872 KB Output is correct
2 Incorrect 28 ms 31872 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 31 ms 31864 KB Output is correct
2 Incorrect 26 ms 31872 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 29 ms 31796 KB Output is correct
2 Incorrect 30 ms 31832 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 31 ms 31864 KB Output is correct
2 Incorrect 29 ms 31792 KB Output isn't correct
3 Halted 0 ms 0 KB -