답안 #74279

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
74279 2018-08-30T19:46:27 Z Vardanyan Bali Sculptures (APIO15_sculpture) C++14
9 / 100
277 ms 263168 KB
//#pragma GCC optimize "-O3"
#include <bits/stdc++.h>
using namespace std;
const int N = 2005;
int A[N];
int K;
int n;
vector<long long> dp[N][N];
int main()
{
    int a,b;
    scanf("%d%d%d",&n,&a,&b);
    for(int i = 1;i<=n;i++) scanf("%d",&A[i]);
    long long c = 0;
    for(int i = 1;i<=n;i++){
        c+=A[i];
        dp[i][1].push_back(c);
    }
    long long ans = 10000000000000007;
    for(int k = 2;k<=b;k++){
        for(int i = 1;i<=n;i++){
            c = A[i];
            for(int j = i-1;j>=1;j--){
                for(int q = 0;q<dp[j][k-1].size();q++){
                    dp[i][k].push_back(dp[j][k-1][q]|c);
               //     if(k>=a && i == n) ans = min(ans,dp[j][k-1][q]|c);
                }
                c+=A[j];
            }
        }
    }
    for(int i = a;i<=b;i++){
        for(int j = 0;j<dp[n][i].size();j++){
            ans = min(ans,dp[n][i][j]);
        }
    }
    cout<<ans<<endl;
    return 0;
}

Compilation message

sculpture.cpp: In function 'int main()':
sculpture.cpp:24:32: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
                 for(int q = 0;q<dp[j][k-1].size();q++){
                               ~^~~~~~~~~~~~~~~~~~
sculpture.cpp:33:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int j = 0;j<dp[n][i].size();j++){
                       ~^~~~~~~~~~~~~~~~
sculpture.cpp:12: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:34: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(int i = 1;i<=n;i++) scanf("%d",&A[i]);
                             ~~~~~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 78 ms 94712 KB Output is correct
2 Correct 78 ms 94712 KB Output is correct
3 Correct 77 ms 94872 KB Output is correct
4 Correct 78 ms 94948 KB Output is correct
5 Correct 79 ms 95152 KB Output is correct
6 Correct 79 ms 95324 KB Output is correct
7 Correct 77 ms 95324 KB Output is correct
8 Correct 80 ms 95324 KB Output is correct
9 Correct 78 ms 95324 KB Output is correct
10 Correct 80 ms 95324 KB Output is correct
11 Correct 78 ms 95324 KB Output is correct
12 Correct 77 ms 95324 KB Output is correct
13 Correct 91 ms 104276 KB Output is correct
14 Correct 78 ms 104276 KB Output is correct
15 Correct 80 ms 104276 KB Output is correct
16 Correct 79 ms 104276 KB Output is correct
17 Correct 79 ms 104276 KB Output is correct
18 Correct 78 ms 104276 KB Output is correct
19 Correct 80 ms 104276 KB Output is correct
20 Correct 81 ms 104276 KB Output is correct
21 Correct 81 ms 104276 KB Output is correct
22 Correct 82 ms 104276 KB Output is correct
23 Correct 81 ms 104276 KB Output is correct
24 Correct 79 ms 104276 KB Output is correct
25 Correct 80 ms 104276 KB Output is correct
26 Correct 93 ms 104276 KB Output is correct
27 Correct 79 ms 104276 KB Output is correct
28 Correct 78 ms 104276 KB Output is correct
29 Correct 81 ms 104276 KB Output is correct
30 Correct 77 ms 104276 KB Output is correct
31 Correct 81 ms 104276 KB Output is correct
32 Correct 81 ms 104276 KB Output is correct
33 Correct 89 ms 104276 KB Output is correct
34 Correct 91 ms 104360 KB Output is correct
35 Correct 77 ms 104360 KB Output is correct
36 Correct 89 ms 104416 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 77 ms 104416 KB Output is correct
2 Correct 78 ms 104416 KB Output is correct
3 Correct 78 ms 104416 KB Output is correct
4 Correct 78 ms 104416 KB Output is correct
5 Correct 78 ms 104416 KB Output is correct
6 Correct 79 ms 104416 KB Output is correct
7 Correct 79 ms 104416 KB Output is correct
8 Correct 79 ms 104416 KB Output is correct
9 Correct 77 ms 104416 KB Output is correct
10 Correct 82 ms 104416 KB Output is correct
11 Correct 79 ms 104416 KB Output is correct
12 Correct 77 ms 104416 KB Output is correct
13 Correct 90 ms 104416 KB Output is correct
14 Correct 83 ms 104416 KB Output is correct
15 Correct 78 ms 104416 KB Output is correct
16 Correct 78 ms 104416 KB Output is correct
17 Correct 78 ms 104416 KB Output is correct
18 Correct 79 ms 104416 KB Output is correct
19 Correct 78 ms 104416 KB Output is correct
20 Correct 91 ms 104416 KB Output is correct
21 Correct 79 ms 104416 KB Output is correct
22 Correct 81 ms 104416 KB Output is correct
23 Correct 79 ms 104416 KB Output is correct
24 Correct 85 ms 104416 KB Output is correct
25 Correct 80 ms 104416 KB Output is correct
26 Correct 96 ms 104416 KB Output is correct
27 Correct 102 ms 113484 KB Output is correct
28 Correct 169 ms 167492 KB Output is correct
29 Correct 86 ms 167492 KB Output is correct
30 Runtime error 277 ms 263168 KB Execution killed with signal 9 (could be triggered by violating memory limits)
31 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 82 ms 263168 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 78 ms 263168 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 84 ms 263168 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
2 Halted 0 ms 0 KB -