답안 #278838

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
278838 2020-08-22T00:52:59 Z jainbot27 Bali Sculptures (APIO15_sculpture) C++17
9 / 100
1000 ms 1464 KB
#include <bits/stdc++.h>
using namespace std;

using ll = long long;
const int N = 2001;
int dp[N], a[N], n, aa, b, dp1[N][N];
ll mx = 0, p[N];

bool works(int bit){
    /*
    if(aa == 1){
        ll most = mx + (1LL << bit);
        for(int i=0; i<=n; i++){
            dp[i] = 1e9;
        }
        dp[0] = 0;
        for(int i=1; i <= n; i++){
            for(int j = 0; j < i; j++){
                ll sum = p[i] - p[j]; 
                if((sum|mx) < most){
                    dp[i] = min(dp[i], dp[j] + 1);
                }
            }
        }
        return dp[n]>b;
    }
    else{
    */
        cerr << "BIT " << bit << "\n";
        ll most = mx + (1LL << bit);
        for(int i=0; i <= n; i++){
            for(int j=0; j <= n; j++){
                dp1[i][j] = 0;
            }
        }
        dp1[0][0] = 1;
        for(int i=1; i<=n; i++){
            for(int j=1; j <= i; j++){
                for(int k=0; k < i; k++){
                    if(dp1[k][j-1] && ((p[i] - p[k])|mx)<most){
                        dp1[i][j]|=1;
                    }
                }
            }
        }
        for(int i = 0; i <= n; i++){
            for(int j = 0; j <= n; j++){
                cerr << "(" << i << "," << j << ") " << dp1[i][j] << "\n";
            }
        }
        for(int i = aa; i <= b; i++){
            if(dp1[n][i]){
                return 0;
            }
        }
        return 1;
    //}
}
int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> n >> aa >> b;
    for(int i = 1; i <= n; i++){
        cin >> a[i];
        p[i] = p[i-1] + a[i];
    }
    for(int bit = 40; bit >= 0; bit--){
        if(works(bit)){
            mx += 1LL << bit;
        }
    }
    cout << mx << "\n";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 36 ms 384 KB Output is correct
2 Correct 50 ms 384 KB Output is correct
3 Correct 3 ms 384 KB Output is correct
4 Correct 23 ms 384 KB Output is correct
5 Correct 78 ms 504 KB Output is correct
6 Correct 175 ms 632 KB Output is correct
7 Correct 197 ms 504 KB Output is correct
8 Correct 269 ms 632 KB Output is correct
9 Correct 273 ms 760 KB Output is correct
10 Correct 266 ms 632 KB Output is correct
11 Correct 271 ms 632 KB Output is correct
12 Correct 270 ms 636 KB Output is correct
13 Correct 269 ms 652 KB Output is correct
14 Correct 30 ms 384 KB Output is correct
15 Correct 31 ms 384 KB Output is correct
16 Correct 31 ms 384 KB Output is correct
17 Correct 23 ms 384 KB Output is correct
18 Correct 74 ms 384 KB Output is correct
19 Correct 160 ms 504 KB Output is correct
20 Correct 197 ms 508 KB Output is correct
21 Correct 271 ms 760 KB Output is correct
22 Correct 271 ms 632 KB Output is correct
23 Correct 272 ms 632 KB Output is correct
24 Correct 275 ms 760 KB Output is correct
25 Correct 271 ms 632 KB Output is correct
26 Correct 293 ms 632 KB Output is correct
27 Correct 26 ms 384 KB Output is correct
28 Correct 82 ms 488 KB Output is correct
29 Correct 122 ms 504 KB Output is correct
30 Correct 249 ms 632 KB Output is correct
31 Correct 305 ms 632 KB Output is correct
32 Correct 280 ms 632 KB Output is correct
33 Correct 277 ms 632 KB Output is correct
34 Correct 272 ms 632 KB Output is correct
35 Correct 273 ms 888 KB Output is correct
36 Correct 272 ms 760 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 31 ms 384 KB Output is correct
2 Correct 51 ms 384 KB Output is correct
3 Correct 3 ms 384 KB Output is correct
4 Correct 23 ms 384 KB Output is correct
5 Correct 76 ms 384 KB Output is correct
6 Correct 159 ms 504 KB Output is correct
7 Correct 198 ms 504 KB Output is correct
8 Correct 287 ms 632 KB Output is correct
9 Correct 294 ms 684 KB Output is correct
10 Correct 296 ms 784 KB Output is correct
11 Correct 279 ms 632 KB Output is correct
12 Correct 279 ms 632 KB Output is correct
13 Correct 278 ms 764 KB Output is correct
14 Correct 31 ms 384 KB Output is correct
15 Correct 31 ms 416 KB Output is correct
16 Correct 38 ms 384 KB Output is correct
17 Correct 23 ms 384 KB Output is correct
18 Correct 78 ms 396 KB Output is correct
19 Correct 158 ms 504 KB Output is correct
20 Correct 234 ms 504 KB Output is correct
21 Correct 267 ms 556 KB Output is correct
22 Correct 309 ms 632 KB Output is correct
23 Correct 276 ms 632 KB Output is correct
24 Correct 266 ms 636 KB Output is correct
25 Correct 273 ms 648 KB Output is correct
26 Correct 275 ms 632 KB Output is correct
27 Correct 297 ms 632 KB Output is correct
28 Correct 418 ms 760 KB Output is correct
29 Correct 929 ms 1144 KB Output is correct
30 Execution timed out 1093 ms 1272 KB Time limit exceeded
31 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 32 ms 384 KB Output is correct
2 Correct 51 ms 384 KB Output is correct
3 Correct 3 ms 384 KB Output is correct
4 Correct 23 ms 384 KB Output is correct
5 Correct 74 ms 504 KB Output is correct
6 Correct 157 ms 504 KB Output is correct
7 Correct 198 ms 528 KB Output is correct
8 Correct 272 ms 632 KB Output is correct
9 Correct 282 ms 632 KB Output is correct
10 Correct 271 ms 632 KB Output is correct
11 Correct 270 ms 760 KB Output is correct
12 Correct 316 ms 632 KB Output is correct
13 Correct 281 ms 632 KB Output is correct
14 Correct 302 ms 760 KB Output is correct
15 Correct 412 ms 760 KB Output is correct
16 Correct 962 ms 1248 KB Output is correct
17 Execution timed out 1092 ms 1380 KB Time limit exceeded
18 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 31 ms 384 KB Output is correct
2 Correct 50 ms 384 KB Output is correct
3 Correct 3 ms 384 KB Output is correct
4 Correct 23 ms 504 KB Output is correct
5 Correct 78 ms 632 KB Output is correct
6 Correct 160 ms 504 KB Output is correct
7 Correct 199 ms 504 KB Output is correct
8 Correct 277 ms 632 KB Output is correct
9 Correct 265 ms 632 KB Output is correct
10 Correct 277 ms 632 KB Output is correct
11 Correct 277 ms 632 KB Output is correct
12 Correct 271 ms 632 KB Output is correct
13 Correct 274 ms 632 KB Output is correct
14 Correct 31 ms 512 KB Output is correct
15 Correct 31 ms 384 KB Output is correct
16 Correct 40 ms 384 KB Output is correct
17 Correct 28 ms 384 KB Output is correct
18 Correct 74 ms 384 KB Output is correct
19 Correct 161 ms 760 KB Output is correct
20 Correct 202 ms 504 KB Output is correct
21 Correct 271 ms 632 KB Output is correct
22 Correct 289 ms 632 KB Output is correct
23 Correct 273 ms 732 KB Output is correct
24 Correct 305 ms 760 KB Output is correct
25 Correct 268 ms 632 KB Output is correct
26 Correct 271 ms 632 KB Output is correct
27 Correct 26 ms 384 KB Output is correct
28 Correct 75 ms 384 KB Output is correct
29 Correct 118 ms 504 KB Output is correct
30 Correct 244 ms 632 KB Output is correct
31 Correct 270 ms 632 KB Output is correct
32 Correct 274 ms 636 KB Output is correct
33 Correct 271 ms 760 KB Output is correct
34 Correct 268 ms 632 KB Output is correct
35 Correct 271 ms 760 KB Output is correct
36 Correct 272 ms 632 KB Output is correct
37 Correct 298 ms 760 KB Output is correct
38 Correct 418 ms 888 KB Output is correct
39 Correct 930 ms 1272 KB Output is correct
40 Execution timed out 1093 ms 1276 KB Time limit exceeded
41 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 31 ms 512 KB Output is correct
2 Correct 54 ms 504 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Correct 25 ms 384 KB Output is correct
5 Correct 75 ms 384 KB Output is correct
6 Correct 156 ms 504 KB Output is correct
7 Correct 208 ms 504 KB Output is correct
8 Correct 281 ms 564 KB Output is correct
9 Correct 274 ms 632 KB Output is correct
10 Correct 274 ms 632 KB Output is correct
11 Correct 269 ms 632 KB Output is correct
12 Correct 271 ms 632 KB Output is correct
13 Correct 268 ms 632 KB Output is correct
14 Correct 23 ms 384 KB Output is correct
15 Correct 74 ms 384 KB Output is correct
16 Correct 126 ms 504 KB Output is correct
17 Correct 245 ms 504 KB Output is correct
18 Correct 273 ms 684 KB Output is correct
19 Correct 300 ms 632 KB Output is correct
20 Correct 269 ms 632 KB Output is correct
21 Correct 293 ms 632 KB Output is correct
22 Correct 271 ms 632 KB Output is correct
23 Correct 275 ms 632 KB Output is correct
24 Correct 299 ms 660 KB Output is correct
25 Correct 417 ms 784 KB Output is correct
26 Correct 931 ms 1112 KB Output is correct
27 Execution timed out 1077 ms 1464 KB Time limit exceeded
28 Halted 0 ms 0 KB -