답안 #489706

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
489706 2021-11-24T02:44:46 Z mdn2002 Bali Sculptures (APIO15_sculpture) C++14
71 / 100
1000 ms 31904 KB
#include<bits/stdc++.h>
using namespace std;
long long n , a , b , y [2003] , dp [2003][2003] , mask;
long long f ( int x , int num )
{
    if ( x == n )
    {
        if ( a <= num && num <= b ) return 1;
        return 0;
    }
    if ( dp [x][num] != -1 ) return dp [x][num];
    long long ans = 0 , sum = 0;
    for ( int i = x ; i < n ; i ++ )
    {
        sum += y [i];
        if ( ( mask | sum ) > mask ) continue;
        ans = max ( ans , f ( i + 1 , num + 1 ) );
    }
    return dp [x][num] = ans;
}
bool ck ( )
{
    memset ( dp , -1 , sizeof dp );
    return f ( 0 , 0 );
}
int main()
{
    //freopen ( "fence8.in" , "r" , stdin );
    //freopen ( "fence8.out" , "w" , stdout );
    cin >> n >> a >> b;
    for ( int i = 0 ; i < n ; i ++ ) cin >> y [i];
    mask = ( 1ll << 50 ) - 1;
    for ( int i = 49 ; i >= 0 ; i -- )
    {
        mask ^= ( 1ll << i );
        if ( ck ( ) == 0 ) mask ^= ( 1ll << i );
    }
    cout << mask;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 180 ms 31692 KB Output is correct
2 Correct 184 ms 31684 KB Output is correct
3 Correct 187 ms 31692 KB Output is correct
4 Correct 180 ms 31692 KB Output is correct
5 Correct 187 ms 31692 KB Output is correct
6 Correct 185 ms 31692 KB Output is correct
7 Correct 194 ms 31572 KB Output is correct
8 Correct 183 ms 31692 KB Output is correct
9 Correct 183 ms 31692 KB Output is correct
10 Correct 181 ms 31692 KB Output is correct
11 Correct 185 ms 31692 KB Output is correct
12 Correct 183 ms 31688 KB Output is correct
13 Correct 203 ms 31692 KB Output is correct
14 Correct 189 ms 31680 KB Output is correct
15 Correct 188 ms 31692 KB Output is correct
16 Correct 183 ms 31684 KB Output is correct
17 Correct 187 ms 31692 KB Output is correct
18 Correct 191 ms 31692 KB Output is correct
19 Correct 183 ms 31692 KB Output is correct
20 Correct 185 ms 31692 KB Output is correct
21 Correct 188 ms 31692 KB Output is correct
22 Correct 187 ms 31696 KB Output is correct
23 Correct 183 ms 31692 KB Output is correct
24 Correct 187 ms 31692 KB Output is correct
25 Correct 184 ms 31676 KB Output is correct
26 Correct 182 ms 31692 KB Output is correct
27 Correct 180 ms 31692 KB Output is correct
28 Correct 183 ms 31692 KB Output is correct
29 Correct 184 ms 31692 KB Output is correct
30 Correct 181 ms 31648 KB Output is correct
31 Correct 181 ms 31692 KB Output is correct
32 Correct 180 ms 31692 KB Output is correct
33 Correct 183 ms 31692 KB Output is correct
34 Correct 197 ms 31684 KB Output is correct
35 Correct 179 ms 31684 KB Output is correct
36 Correct 187 ms 31692 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 179 ms 31692 KB Output is correct
2 Correct 180 ms 31692 KB Output is correct
3 Correct 207 ms 31692 KB Output is correct
4 Correct 188 ms 31692 KB Output is correct
5 Correct 185 ms 31692 KB Output is correct
6 Correct 190 ms 31692 KB Output is correct
7 Correct 182 ms 31684 KB Output is correct
8 Correct 191 ms 31692 KB Output is correct
9 Correct 189 ms 31696 KB Output is correct
10 Correct 190 ms 31692 KB Output is correct
11 Correct 183 ms 31680 KB Output is correct
12 Correct 195 ms 31692 KB Output is correct
13 Correct 185 ms 31692 KB Output is correct
14 Correct 186 ms 31684 KB Output is correct
15 Correct 187 ms 31572 KB Output is correct
16 Correct 191 ms 31692 KB Output is correct
17 Correct 189 ms 31680 KB Output is correct
18 Correct 183 ms 31692 KB Output is correct
19 Correct 183 ms 31692 KB Output is correct
20 Correct 184 ms 31692 KB Output is correct
21 Correct 181 ms 31692 KB Output is correct
22 Correct 185 ms 31692 KB Output is correct
23 Correct 189 ms 31680 KB Output is correct
24 Correct 184 ms 31692 KB Output is correct
25 Correct 182 ms 31692 KB Output is correct
26 Correct 191 ms 31692 KB Output is correct
27 Correct 189 ms 31612 KB Output is correct
28 Correct 184 ms 31692 KB Output is correct
29 Correct 183 ms 31692 KB Output is correct
30 Correct 189 ms 31692 KB Output is correct
31 Correct 187 ms 31676 KB Output is correct
32 Correct 186 ms 31692 KB Output is correct
33 Correct 204 ms 31692 KB Output is correct
34 Correct 188 ms 31680 KB Output is correct
35 Correct 185 ms 31692 KB Output is correct
36 Correct 194 ms 31672 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 185 ms 31692 KB Output is correct
2 Correct 181 ms 31692 KB Output is correct
3 Correct 184 ms 31692 KB Output is correct
4 Correct 188 ms 31564 KB Output is correct
5 Correct 189 ms 31692 KB Output is correct
6 Correct 183 ms 31692 KB Output is correct
7 Correct 183 ms 31692 KB Output is correct
8 Correct 194 ms 31672 KB Output is correct
9 Correct 203 ms 31692 KB Output is correct
10 Correct 197 ms 31680 KB Output is correct
11 Correct 181 ms 31692 KB Output is correct
12 Correct 185 ms 31744 KB Output is correct
13 Correct 182 ms 31692 KB Output is correct
14 Correct 186 ms 31692 KB Output is correct
15 Correct 186 ms 31692 KB Output is correct
16 Correct 185 ms 31640 KB Output is correct
17 Correct 187 ms 31680 KB Output is correct
18 Correct 189 ms 31692 KB Output is correct
19 Correct 189 ms 31704 KB Output is correct
20 Correct 189 ms 31692 KB Output is correct
21 Correct 191 ms 31692 KB Output is correct
22 Correct 193 ms 31692 KB Output is correct
23 Correct 186 ms 31644 KB Output is correct
24 Correct 190 ms 31692 KB Output is correct
25 Correct 194 ms 31692 KB Output is correct
26 Correct 205 ms 31680 KB Output is correct
27 Correct 207 ms 31692 KB Output is correct
28 Correct 239 ms 31692 KB Output is correct
29 Correct 218 ms 31692 KB Output is correct
30 Correct 220 ms 31692 KB Output is correct
31 Correct 213 ms 31616 KB Output is correct
32 Correct 220 ms 31692 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 186 ms 31692 KB Output is correct
2 Correct 195 ms 31692 KB Output is correct
3 Correct 183 ms 31692 KB Output is correct
4 Correct 184 ms 31692 KB Output is correct
5 Correct 183 ms 31692 KB Output is correct
6 Correct 181 ms 31692 KB Output is correct
7 Correct 188 ms 31692 KB Output is correct
8 Correct 184 ms 31692 KB Output is correct
9 Correct 186 ms 31572 KB Output is correct
10 Correct 189 ms 31692 KB Output is correct
11 Correct 184 ms 31680 KB Output is correct
12 Correct 184 ms 31692 KB Output is correct
13 Correct 183 ms 31692 KB Output is correct
14 Correct 186 ms 31812 KB Output is correct
15 Correct 184 ms 31672 KB Output is correct
16 Correct 180 ms 31692 KB Output is correct
17 Correct 180 ms 31676 KB Output is correct
18 Correct 184 ms 31696 KB Output is correct
19 Correct 184 ms 31692 KB Output is correct
20 Correct 188 ms 31692 KB Output is correct
21 Correct 188 ms 31680 KB Output is correct
22 Correct 182 ms 31692 KB Output is correct
23 Correct 181 ms 31692 KB Output is correct
24 Correct 185 ms 31692 KB Output is correct
25 Correct 185 ms 31572 KB Output is correct
26 Correct 183 ms 31692 KB Output is correct
27 Correct 183 ms 31692 KB Output is correct
28 Correct 189 ms 31692 KB Output is correct
29 Correct 181 ms 31692 KB Output is correct
30 Correct 181 ms 31692 KB Output is correct
31 Correct 180 ms 31680 KB Output is correct
32 Correct 180 ms 31692 KB Output is correct
33 Correct 186 ms 31692 KB Output is correct
34 Correct 181 ms 31676 KB Output is correct
35 Correct 184 ms 31772 KB Output is correct
36 Correct 183 ms 31692 KB Output is correct
37 Correct 182 ms 31608 KB Output is correct
38 Correct 183 ms 31676 KB Output is correct
39 Correct 189 ms 31764 KB Output is correct
40 Correct 187 ms 31692 KB Output is correct
41 Correct 186 ms 31692 KB Output is correct
42 Correct 191 ms 31692 KB Output is correct
43 Correct 186 ms 31676 KB Output is correct
44 Correct 200 ms 31692 KB Output is correct
45 Correct 184 ms 31580 KB Output is correct
46 Correct 192 ms 31692 KB Output is correct
47 Correct 189 ms 31692 KB Output is correct
48 Correct 192 ms 31692 KB Output is correct
49 Correct 210 ms 31692 KB Output is correct
50 Correct 205 ms 31692 KB Output is correct
51 Correct 217 ms 31692 KB Output is correct
52 Correct 228 ms 31692 KB Output is correct
53 Correct 217 ms 31692 KB Output is correct
54 Correct 214 ms 31692 KB Output is correct
55 Correct 216 ms 31692 KB Output is correct
56 Correct 195 ms 31692 KB Output is correct
57 Correct 191 ms 31692 KB Output is correct
58 Correct 228 ms 31692 KB Output is correct
59 Correct 198 ms 31696 KB Output is correct
60 Correct 195 ms 31692 KB Output is correct
61 Correct 194 ms 31692 KB Output is correct
62 Correct 194 ms 31692 KB Output is correct
63 Correct 198 ms 31684 KB Output is correct
64 Correct 207 ms 31692 KB Output is correct
65 Correct 185 ms 31692 KB Output is correct
66 Correct 190 ms 31904 KB Output is correct
67 Correct 188 ms 31692 KB Output is correct
68 Correct 194 ms 31692 KB Output is correct
69 Correct 195 ms 31700 KB Output is correct
70 Correct 200 ms 31692 KB Output is correct
71 Correct 199 ms 31692 KB Output is correct
72 Correct 205 ms 31692 KB Output is correct
73 Correct 197 ms 31692 KB Output is correct
74 Correct 198 ms 31768 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 180 ms 31604 KB Output is correct
2 Correct 184 ms 31692 KB Output is correct
3 Correct 190 ms 31692 KB Output is correct
4 Correct 181 ms 31692 KB Output is correct
5 Correct 195 ms 31692 KB Output is correct
6 Correct 187 ms 31664 KB Output is correct
7 Correct 184 ms 31664 KB Output is correct
8 Correct 186 ms 31692 KB Output is correct
9 Correct 190 ms 31692 KB Output is correct
10 Correct 194 ms 31680 KB Output is correct
11 Correct 184 ms 31692 KB Output is correct
12 Correct 191 ms 31692 KB Output is correct
13 Correct 182 ms 31680 KB Output is correct
14 Correct 181 ms 31692 KB Output is correct
15 Correct 184 ms 31644 KB Output is correct
16 Correct 185 ms 31692 KB Output is correct
17 Correct 182 ms 31648 KB Output is correct
18 Correct 184 ms 31692 KB Output is correct
19 Correct 185 ms 31688 KB Output is correct
20 Correct 195 ms 31692 KB Output is correct
21 Correct 181 ms 31692 KB Output is correct
22 Correct 183 ms 31656 KB Output is correct
23 Correct 188 ms 31692 KB Output is correct
24 Correct 183 ms 31692 KB Output is correct
25 Correct 196 ms 31680 KB Output is correct
26 Correct 188 ms 31692 KB Output is correct
27 Correct 207 ms 31692 KB Output is correct
28 Correct 186 ms 31680 KB Output is correct
29 Correct 187 ms 31692 KB Output is correct
30 Correct 190 ms 31692 KB Output is correct
31 Correct 187 ms 31620 KB Output is correct
32 Correct 192 ms 31692 KB Output is correct
33 Correct 188 ms 31692 KB Output is correct
34 Correct 187 ms 31692 KB Output is correct
35 Correct 193 ms 31692 KB Output is correct
36 Correct 198 ms 31692 KB Output is correct
37 Correct 211 ms 31680 KB Output is correct
38 Correct 215 ms 31692 KB Output is correct
39 Correct 212 ms 31692 KB Output is correct
40 Correct 217 ms 31692 KB Output is correct
41 Correct 213 ms 31692 KB Output is correct
42 Correct 213 ms 31692 KB Output is correct
43 Correct 186 ms 31680 KB Output is correct
44 Correct 192 ms 31692 KB Output is correct
45 Correct 194 ms 31692 KB Output is correct
46 Correct 195 ms 31692 KB Output is correct
47 Correct 197 ms 31748 KB Output is correct
48 Correct 198 ms 31692 KB Output is correct
49 Correct 214 ms 31696 KB Output is correct
50 Correct 205 ms 31680 KB Output is correct
51 Correct 195 ms 31588 KB Output is correct
52 Execution timed out 1060 ms 31692 KB Time limit exceeded
53 Halted 0 ms 0 KB -