답안 #207491

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
207491 2020-03-07T16:15:06 Z DystoriaX Bali Sculptures (APIO15_sculpture) C++14
0 / 100
6 ms 376 KB
#include <bits/stdc++.h>

using namespace std;

int n, a, b;
int y[100010];
long long dp[1010][1010], pref[1010];

int main(){
    scanf("%d%d%d", &n, &a, &b);

    for(int i = 1; i <= n; i++){
        scanf("%d", &y[i]);
        pref[i] = y[i] + pref[i - 1];
    }

    for(int i = 0; i <= n; i++)
        for(int j = 0; j <= n; j++)
            dp[i][j] = 1e18;

    dp[0][0] = 0;

    for(int j = 1; j <= n; j++){
        for(int i = j; i <= n; i++){
            for(int k = j - 1; k < i; k++){
                dp[i][j] = min(dp[i][j], dp[k][j - 1] | (pref[i] - pref[k]));
            }
        }
    }

    long long ans = 1e18;

    for(int i = a; i <= b; i++) ans = min(ans, dp[n][i]);

    printf("%lld\n", ans);
    
    return 0;
}

Compilation message

sculpture.cpp: In function 'int main()':
sculpture.cpp:10:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d%d", &n, &a, &b);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~~
sculpture.cpp:13:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d", &y[i]);
         ~~~~~^~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 376 KB Output is correct
2 Incorrect 5 ms 376 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 376 KB Output is correct
2 Incorrect 5 ms 376 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 376 KB Output is correct
2 Incorrect 6 ms 372 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 376 KB Output is correct
2 Incorrect 5 ms 376 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 376 KB Output is correct
2 Incorrect 5 ms 376 KB Output isn't correct
3 Halted 0 ms 0 KB -