답안 #207627

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
207627 2020-03-08T07:47:07 Z DystoriaX Bali Sculptures (APIO15_sculpture) C++14
21 / 100
30 ms 2296 KB
#include <bits/stdc++.h>
 
using namespace std;
 
int n, a, b;
int y[100010];
long long dp[1010][3010];
long long pref[1010], mx;
const int lgmx = 11;
 
int main(){
    // freopen("input.txt", "r", stdin);

    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 = 1; i <= n; i++){
        for(int j = 0; j < (1 << lgmx); j++){
            dp[i][j] = 1e18;
        }
    }

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

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

    for(int i = 0; i < (1 << lgmx); i++){
        if(dp[n][i] <= b){
            printf("%d\n", i);
            exit(0);
        }
    }
    
    return 0;
}

Compilation message

sculpture.cpp: In function 'int main()':
sculpture.cpp:14: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:17: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 Correct 5 ms 504 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 5 ms 504 KB Output is correct
6 Correct 6 ms 632 KB Output is correct
7 Correct 5 ms 632 KB Output is correct
8 Correct 6 ms 760 KB Output is correct
9 Correct 6 ms 764 KB Output is correct
10 Correct 6 ms 760 KB Output is correct
11 Correct 6 ms 760 KB Output is correct
12 Correct 6 ms 764 KB Output is correct
13 Correct 6 ms 760 KB Output is correct
14 Correct 5 ms 496 KB Output is correct
15 Incorrect 5 ms 380 KB Output isn't correct
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 6 ms 632 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 5 ms 504 KB Output is correct
6 Correct 5 ms 632 KB Output is correct
7 Correct 5 ms 632 KB Output is correct
8 Correct 6 ms 760 KB Output is correct
9 Correct 6 ms 760 KB Output is correct
10 Correct 6 ms 760 KB Output is correct
11 Correct 8 ms 760 KB Output is correct
12 Correct 7 ms 760 KB Output is correct
13 Correct 6 ms 760 KB Output is correct
14 Correct 5 ms 376 KB Output is correct
15 Incorrect 5 ms 376 KB Output isn't correct
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 504 KB Output is correct
2 Correct 5 ms 504 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 5 ms 504 KB Output is correct
6 Correct 5 ms 632 KB Output is correct
7 Correct 5 ms 632 KB Output is correct
8 Correct 6 ms 764 KB Output is correct
9 Correct 6 ms 760 KB Output is correct
10 Correct 6 ms 760 KB Output is correct
11 Correct 6 ms 760 KB Output is correct
12 Correct 6 ms 760 KB Output is correct
13 Correct 6 ms 760 KB Output is correct
14 Correct 6 ms 760 KB Output is correct
15 Correct 6 ms 760 KB Output is correct
16 Correct 8 ms 1144 KB Output is correct
17 Correct 9 ms 1144 KB Output is correct
18 Correct 10 ms 1272 KB Output is correct
19 Correct 11 ms 1272 KB Output is correct
20 Correct 11 ms 1272 KB Output is correct
21 Correct 11 ms 1272 KB Output is correct
22 Correct 9 ms 1272 KB Output is correct
23 Correct 10 ms 1400 KB Output is correct
24 Correct 10 ms 1400 KB Output is correct
25 Correct 13 ms 1656 KB Output is correct
26 Correct 16 ms 1912 KB Output is correct
27 Correct 17 ms 2168 KB Output is correct
28 Correct 20 ms 2296 KB Output is correct
29 Correct 30 ms 2296 KB Output is correct
30 Correct 28 ms 2296 KB Output is correct
31 Correct 21 ms 2296 KB Output is correct
32 Correct 20 ms 2296 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 504 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 5 ms 504 KB Output is correct
6 Correct 6 ms 760 KB Output is correct
7 Correct 6 ms 760 KB Output is correct
8 Correct 6 ms 760 KB Output is correct
9 Correct 6 ms 760 KB Output is correct
10 Correct 6 ms 760 KB Output is correct
11 Correct 6 ms 760 KB Output is correct
12 Correct 6 ms 760 KB Output is correct
13 Correct 6 ms 760 KB Output is correct
14 Correct 5 ms 376 KB Output is correct
15 Incorrect 6 ms 504 KB Output isn't correct
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 504 KB Output is correct
3 Correct 5 ms 380 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 5 ms 508 KB Output is correct
6 Correct 5 ms 632 KB Output is correct
7 Correct 5 ms 632 KB Output is correct
8 Correct 6 ms 760 KB Output is correct
9 Correct 6 ms 764 KB Output is correct
10 Correct 6 ms 760 KB Output is correct
11 Correct 7 ms 760 KB Output is correct
12 Correct 6 ms 760 KB Output is correct
13 Correct 6 ms 760 KB Output is correct
14 Runtime error 6 ms 760 KB Execution killed with signal 11 (could be triggered by violating memory limits)
15 Halted 0 ms 0 KB -