답안 #106366

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
106366 2019-04-18T03:18:43 Z Hideo Bali Sculptures (APIO15_sculpture) C++14
0 / 100
637 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 = 107;
const int INF = 1e9 + 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("%d", &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:26: warning: format '%d' expects argument of type 'int*', but argument 2 has type 'long long int*' [-Wformat=]
         scanf("%d", &x[i]);
                     ~~~~~^
sculpture.cpp:27:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d", &x[i]);
         ~~~~~^~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 384 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Runtime error 611 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 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 3 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Runtime error 637 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 2 ms 384 KB Output is correct
2 Correct 3 ms 512 KB Output is correct
3 Correct 3 ms 384 KB Output is correct
4 Correct 3 ms 384 KB Output is correct
5 Correct 3 ms 512 KB Output is correct
6 Runtime error 607 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 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 356 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 3 ms 384 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 3 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Runtime error 579 ms 263168 KB Execution killed with signal 9 (could be triggered by violating memory limits)
7 Halted 0 ms 0 KB -