답안 #106596

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
106596 2019-04-19T07:18:37 Z abil Bali Sculptures (APIO15_sculpture) C++14
0 / 100
34 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++){
            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(){
      ^
# 결과 실행 시간 메모리 Grader output
1 Correct 31 ms 31864 KB Output is correct
2 Incorrect 28 ms 31864 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 26 ms 31864 KB Output is correct
2 Incorrect 26 ms 31864 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 27 ms 31872 KB Output is correct
2 Incorrect 33 ms 31864 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 28 ms 31872 KB Output is correct
2 Incorrect 30 ms 31864 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 28 ms 31864 KB Output is correct
2 Incorrect 34 ms 31864 KB Output isn't correct
3 Halted 0 ms 0 KB -