답안 #74280

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
74280 2018-08-30T19:48:59 Z Vardanyan Bali Sculptures (APIO15_sculpture) C++17
9 / 100
261 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 80 ms 94712 KB Output is correct
2 Correct 78 ms 94812 KB Output is correct
3 Correct 79 ms 94812 KB Output is correct
4 Correct 80 ms 94840 KB Output is correct
5 Correct 79 ms 94844 KB Output is correct
6 Correct 79 ms 95236 KB Output is correct
7 Correct 79 ms 95236 KB Output is correct
8 Correct 79 ms 95236 KB Output is correct
9 Correct 84 ms 95236 KB Output is correct
10 Correct 78 ms 95236 KB Output is correct
11 Correct 84 ms 95236 KB Output is correct
12 Correct 78 ms 95236 KB Output is correct
13 Correct 95 ms 104212 KB Output is correct
14 Correct 80 ms 104212 KB Output is correct
15 Correct 81 ms 104212 KB Output is correct
16 Correct 102 ms 104212 KB Output is correct
17 Correct 80 ms 104212 KB Output is correct
18 Correct 79 ms 104212 KB Output is correct
19 Correct 80 ms 104212 KB Output is correct
20 Correct 83 ms 104212 KB Output is correct
21 Correct 87 ms 104212 KB Output is correct
22 Correct 80 ms 104212 KB Output is correct
23 Correct 88 ms 104212 KB Output is correct
24 Correct 81 ms 104212 KB Output is correct
25 Correct 82 ms 104212 KB Output is correct
26 Correct 90 ms 104212 KB Output is correct
27 Correct 79 ms 104212 KB Output is correct
28 Correct 80 ms 104212 KB Output is correct
29 Correct 79 ms 104212 KB Output is correct
30 Correct 83 ms 104212 KB Output is correct
31 Correct 82 ms 104212 KB Output is correct
32 Correct 82 ms 104212 KB Output is correct
33 Correct 92 ms 104212 KB Output is correct
34 Correct 89 ms 104332 KB Output is correct
35 Correct 79 ms 104332 KB Output is correct
36 Correct 90 ms 104344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 79 ms 104344 KB Output is correct
2 Correct 78 ms 104344 KB Output is correct
3 Correct 80 ms 104344 KB Output is correct
4 Correct 76 ms 104344 KB Output is correct
5 Correct 83 ms 104344 KB Output is correct
6 Correct 78 ms 104344 KB Output is correct
7 Correct 80 ms 104344 KB Output is correct
8 Correct 77 ms 104344 KB Output is correct
9 Correct 79 ms 104344 KB Output is correct
10 Correct 79 ms 104344 KB Output is correct
11 Correct 77 ms 104344 KB Output is correct
12 Correct 80 ms 104344 KB Output is correct
13 Correct 92 ms 104408 KB Output is correct
14 Correct 89 ms 104408 KB Output is correct
15 Correct 80 ms 104408 KB Output is correct
16 Correct 78 ms 104408 KB Output is correct
17 Correct 77 ms 104408 KB Output is correct
18 Correct 78 ms 104408 KB Output is correct
19 Correct 77 ms 104408 KB Output is correct
20 Correct 81 ms 104408 KB Output is correct
21 Correct 82 ms 104408 KB Output is correct
22 Correct 82 ms 104408 KB Output is correct
23 Correct 82 ms 104408 KB Output is correct
24 Correct 78 ms 104408 KB Output is correct
25 Correct 81 ms 104408 KB Output is correct
26 Correct 90 ms 104408 KB Output is correct
27 Correct 105 ms 113552 KB Output is correct
28 Correct 167 ms 167620 KB Output is correct
29 Correct 86 ms 167620 KB Output is correct
30 Runtime error 261 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 80 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 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 -