답안 #106367

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
106367 2019-04-18T03:20:51 Z Hideo Bali Sculptures (APIO15_sculpture) C++14
0 / 100
665 ms 263168 KB
#include <bits/stdc++.h>
using namespace std;

#define ll 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 = 2007;
const ll INF = 1e18 + 7;

ll dp[N][N], pr[N], x[N], ans;
int n, a, b;

vii v[N];

main(){
    ans = INF;
    cin >> n >> a >> b;
    for (int i = 1; i <= n; i++){
        scanf("%lld", &x[i]);
        pr[i] = pr[i - 1] + x[i];
    }
    for (int i = 1; i < N; i++)
        for (int j = 0; j < N; j++)
            dp[i][j] = INF;
    v[0].pb(mk(0, 0));
    for (int i = 1; i <= n; i++){
        for (int g = 1; g <= min(i, b); g++){
            for (pi to : v[g - 1]){
                v[g].pb(mk((to.fr | (pr[i] - pr[to.sc])), i));
                dp[i][g] = min(dp[i][g], (to.fr | (pr[i] - pr[to.sc])));
            }
        }
    }
    for (int i = a; i <= b; i++)
        ans = min(ans, dp[n][i]);
    cout << ans;
}

Compilation message

sculpture.cpp:23:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main(){
      ^
sculpture.cpp: In function 'int main()':
sculpture.cpp:27:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%lld", &x[i]);
         ~~~~~^~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 29 ms 31868 KB Output is correct
2 Correct 29 ms 31872 KB Output is correct
3 Correct 30 ms 31864 KB Output is correct
4 Correct 30 ms 31872 KB Output is correct
5 Correct 27 ms 32000 KB Output is correct
6 Runtime error 631 ms 263168 KB Execution killed with signal 9 (could be triggered by violating memory limits)
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 27 ms 32000 KB Output is correct
2 Correct 29 ms 31864 KB Output is correct
3 Correct 29 ms 31908 KB Output is correct
4 Correct 28 ms 31872 KB Output is correct
5 Correct 30 ms 31864 KB Output is correct
6 Runtime error 665 ms 263168 KB Execution killed with signal 9 (could be triggered by violating memory limits)
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 32 ms 31876 KB Output is correct
2 Correct 26 ms 31872 KB Output is correct
3 Correct 28 ms 31840 KB Output is correct
4 Correct 32 ms 31836 KB Output is correct
5 Correct 33 ms 31864 KB Output is correct
6 Runtime error 642 ms 263168 KB Execution killed with signal 9 (could be triggered by violating memory limits)
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 28 ms 31864 KB Output is correct
2 Correct 29 ms 31864 KB Output is correct
3 Correct 30 ms 31844 KB Output is correct
4 Correct 26 ms 31864 KB Output is correct
5 Correct 27 ms 31912 KB Output is correct
6 Runtime error 566 ms 263168 KB Execution killed with signal 9 (could be triggered by violating memory limits)
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 30 ms 31872 KB Output is correct
2 Correct 31 ms 31864 KB Output is correct
3 Correct 26 ms 31872 KB Output is correct
4 Correct 28 ms 31844 KB Output is correct
5 Correct 30 ms 31864 KB Output is correct
6 Runtime error 577 ms 263168 KB Execution killed with signal 9 (could be triggered by violating memory limits)
7 Halted 0 ms 0 KB -