Submission #205329

# Submission time Handle Problem Language Result Execution time Memory
205329 2020-02-28T14:54:30 Z kshitij_sodani Bali Sculptures (APIO15_sculpture) C++17
71 / 100
1000 ms 4728 KB
#include <iostream>
#include <bits/stdc++.h>
 
using namespace std;
typedef int64_t llo;
#define mp make_pair
#define pb push_back
#define a first
#define b second
#define endl "\n"
 
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	llo n,a,b;
	cin>>n>>a>>b;
	llo it[n];
	for(llo i=0;i<n;i++){
		cin>>it[i];
	}
	llo dp[n][n];
	llo ans=0;

	memset(dp,0,sizeof(dp));
	llo pre[n];
	pre[0]=it[0];

	for(llo i=1;i<n;i++){
		pre[i]=pre[i-1]+it[i];
	}
	
	for(llo i=38;i>=0;i--){
		memset(dp,0,sizeof(dp));
		//cout<<ans<<endl;
		ans=ans+(((llo)1<<(i))-(llo)1);
	//	cout<<i<<endl;
		//cout<<ans<<endl;
		for(llo j=0;j<n;j++){
			for(llo k=0;k<min(j+1,b);k++){

				if(k==0){
					llo no=pre[j];
					no|=ans;
					if(no==ans){
						dp[j][k]=1;
					}
					continue;

				}
				
				for(llo l=0;l<j;l++){

					llo no=(pre[j]-pre[l]);
					no|=ans;

					if(dp[l][k-1]==1 and (no==ans)){
						dp[j][k]=1;
					}
				}
			}
		}
		ans-=(llo)(((llo)1<<(i))-(llo)1);
		//cout<<ans<<endl<<endl;
		llo st=1;
		for(llo j=a-1;j<b;j++){
			if(dp[n-1][j]==1){
				st=0;
				break;
			}
		}
		//cout<<i<<" "<<st<<endl;
		if(st){
			ans|=((llo)1<<i);
		}
	}
	
	cout<<ans<<endl;
	/*llo nno=8|3;
	//cout<<nno<<endl;
 
 
 */
 
 
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 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 376 KB Output is correct
6 Correct 5 ms 376 KB Output is correct
7 Correct 5 ms 376 KB Output is correct
8 Correct 5 ms 376 KB Output is correct
9 Correct 5 ms 376 KB Output is correct
10 Correct 5 ms 376 KB Output is correct
11 Correct 5 ms 376 KB Output is correct
12 Correct 5 ms 376 KB Output is correct
13 Correct 6 ms 376 KB Output is correct
14 Correct 5 ms 376 KB Output is correct
15 Correct 5 ms 376 KB Output is correct
16 Correct 5 ms 376 KB Output is correct
17 Correct 5 ms 376 KB Output is correct
18 Correct 5 ms 376 KB Output is correct
19 Correct 5 ms 380 KB Output is correct
20 Correct 5 ms 380 KB Output is correct
21 Correct 5 ms 376 KB Output is correct
22 Correct 5 ms 376 KB Output is correct
23 Correct 5 ms 376 KB Output is correct
24 Correct 5 ms 376 KB Output is correct
25 Correct 5 ms 376 KB Output is correct
26 Correct 5 ms 376 KB Output is correct
27 Correct 5 ms 376 KB Output is correct
28 Correct 5 ms 376 KB Output is correct
29 Correct 5 ms 376 KB Output is correct
30 Correct 5 ms 376 KB Output is correct
31 Correct 5 ms 376 KB Output is correct
32 Correct 5 ms 376 KB Output is correct
33 Correct 5 ms 376 KB Output is correct
34 Correct 5 ms 376 KB Output is correct
35 Correct 5 ms 376 KB Output is correct
36 Correct 5 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 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 376 KB Output is correct
6 Correct 5 ms 376 KB Output is correct
7 Correct 5 ms 376 KB Output is correct
8 Correct 5 ms 376 KB Output is correct
9 Correct 5 ms 376 KB Output is correct
10 Correct 5 ms 376 KB Output is correct
11 Correct 5 ms 376 KB Output is correct
12 Correct 5 ms 376 KB Output is correct
13 Correct 5 ms 376 KB Output is correct
14 Correct 5 ms 376 KB Output is correct
15 Correct 5 ms 376 KB Output is correct
16 Correct 5 ms 380 KB Output is correct
17 Correct 5 ms 376 KB Output is correct
18 Correct 5 ms 376 KB Output is correct
19 Correct 5 ms 376 KB Output is correct
20 Correct 5 ms 376 KB Output is correct
21 Correct 5 ms 376 KB Output is correct
22 Correct 5 ms 376 KB Output is correct
23 Correct 5 ms 372 KB Output is correct
24 Correct 5 ms 376 KB Output is correct
25 Correct 5 ms 376 KB Output is correct
26 Correct 6 ms 376 KB Output is correct
27 Correct 5 ms 376 KB Output is correct
28 Correct 5 ms 376 KB Output is correct
29 Correct 5 ms 376 KB Output is correct
30 Correct 6 ms 380 KB Output is correct
31 Correct 6 ms 376 KB Output is correct
32 Correct 6 ms 376 KB Output is correct
33 Correct 5 ms 376 KB Output is correct
34 Correct 7 ms 376 KB Output is correct
35 Correct 6 ms 376 KB Output is correct
36 Correct 6 ms 280 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 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 376 KB Output is correct
6 Correct 5 ms 376 KB Output is correct
7 Correct 5 ms 376 KB Output is correct
8 Correct 5 ms 376 KB Output is correct
9 Correct 5 ms 376 KB Output is correct
10 Correct 5 ms 376 KB Output is correct
11 Correct 5 ms 376 KB Output is correct
12 Correct 5 ms 376 KB Output is correct
13 Correct 5 ms 376 KB Output is correct
14 Correct 5 ms 376 KB Output is correct
15 Correct 5 ms 376 KB Output is correct
16 Correct 5 ms 376 KB Output is correct
17 Correct 6 ms 376 KB Output is correct
18 Correct 7 ms 376 KB Output is correct
19 Correct 7 ms 376 KB Output is correct
20 Correct 5 ms 376 KB Output is correct
21 Correct 6 ms 376 KB Output is correct
22 Correct 6 ms 376 KB Output is correct
23 Correct 6 ms 376 KB Output is correct
24 Correct 7 ms 376 KB Output is correct
25 Correct 6 ms 380 KB Output is correct
26 Correct 9 ms 376 KB Output is correct
27 Correct 17 ms 504 KB Output is correct
28 Correct 26 ms 376 KB Output is correct
29 Correct 23 ms 376 KB Output is correct
30 Correct 5 ms 376 KB Output is correct
31 Correct 17 ms 376 KB Output is correct
32 Correct 21 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 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 376 KB Output is correct
6 Correct 5 ms 376 KB Output is correct
7 Correct 5 ms 380 KB Output is correct
8 Correct 5 ms 376 KB Output is correct
9 Correct 5 ms 376 KB Output is correct
10 Correct 5 ms 376 KB Output is correct
11 Correct 5 ms 376 KB Output is correct
12 Correct 5 ms 376 KB Output is correct
13 Correct 6 ms 376 KB Output is correct
14 Correct 5 ms 376 KB Output is correct
15 Correct 5 ms 376 KB Output is correct
16 Correct 5 ms 376 KB Output is correct
17 Correct 5 ms 376 KB Output is correct
18 Correct 5 ms 376 KB Output is correct
19 Correct 5 ms 376 KB Output is correct
20 Correct 5 ms 376 KB Output is correct
21 Correct 5 ms 376 KB Output is correct
22 Correct 5 ms 376 KB Output is correct
23 Correct 5 ms 376 KB Output is correct
24 Correct 5 ms 376 KB Output is correct
25 Correct 5 ms 376 KB Output is correct
26 Correct 5 ms 256 KB Output is correct
27 Correct 5 ms 376 KB Output is correct
28 Correct 5 ms 280 KB Output is correct
29 Correct 5 ms 380 KB Output is correct
30 Correct 5 ms 376 KB Output is correct
31 Correct 5 ms 376 KB Output is correct
32 Correct 5 ms 376 KB Output is correct
33 Correct 5 ms 376 KB Output is correct
34 Correct 5 ms 380 KB Output is correct
35 Correct 5 ms 376 KB Output is correct
36 Correct 5 ms 376 KB Output is correct
37 Correct 5 ms 376 KB Output is correct
38 Correct 5 ms 376 KB Output is correct
39 Correct 5 ms 376 KB Output is correct
40 Correct 6 ms 376 KB Output is correct
41 Correct 6 ms 376 KB Output is correct
42 Correct 6 ms 376 KB Output is correct
43 Correct 5 ms 376 KB Output is correct
44 Correct 6 ms 376 KB Output is correct
45 Correct 6 ms 380 KB Output is correct
46 Correct 6 ms 376 KB Output is correct
47 Correct 7 ms 376 KB Output is correct
48 Correct 6 ms 376 KB Output is correct
49 Correct 9 ms 376 KB Output is correct
50 Correct 16 ms 376 KB Output is correct
51 Correct 24 ms 376 KB Output is correct
52 Correct 25 ms 376 KB Output is correct
53 Correct 5 ms 376 KB Output is correct
54 Correct 17 ms 376 KB Output is correct
55 Correct 21 ms 376 KB Output is correct
56 Correct 6 ms 376 KB Output is correct
57 Correct 8 ms 376 KB Output is correct
58 Correct 13 ms 376 KB Output is correct
59 Correct 17 ms 376 KB Output is correct
60 Correct 20 ms 376 KB Output is correct
61 Correct 5 ms 380 KB Output is correct
62 Correct 20 ms 376 KB Output is correct
63 Correct 20 ms 376 KB Output is correct
64 Correct 19 ms 376 KB Output is correct
65 Correct 6 ms 376 KB Output is correct
66 Correct 6 ms 376 KB Output is correct
67 Correct 8 ms 376 KB Output is correct
68 Correct 13 ms 408 KB Output is correct
69 Correct 18 ms 376 KB Output is correct
70 Correct 17 ms 376 KB Output is correct
71 Correct 5 ms 376 KB Output is correct
72 Correct 20 ms 380 KB Output is correct
73 Correct 19 ms 376 KB Output is correct
74 Correct 17 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 408 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 376 KB Output is correct
6 Correct 5 ms 376 KB Output is correct
7 Correct 5 ms 376 KB Output is correct
8 Correct 5 ms 376 KB Output is correct
9 Correct 5 ms 380 KB Output is correct
10 Correct 5 ms 376 KB Output is correct
11 Correct 5 ms 376 KB Output is correct
12 Correct 5 ms 376 KB Output is correct
13 Correct 5 ms 376 KB Output is correct
14 Correct 5 ms 376 KB Output is correct
15 Correct 5 ms 504 KB Output is correct
16 Correct 5 ms 376 KB Output is correct
17 Correct 5 ms 376 KB Output is correct
18 Correct 5 ms 376 KB Output is correct
19 Correct 5 ms 376 KB Output is correct
20 Correct 5 ms 376 KB Output is correct
21 Correct 5 ms 376 KB Output is correct
22 Correct 5 ms 280 KB Output is correct
23 Correct 5 ms 376 KB Output is correct
24 Correct 5 ms 376 KB Output is correct
25 Correct 5 ms 376 KB Output is correct
26 Correct 5 ms 376 KB Output is correct
27 Correct 6 ms 376 KB Output is correct
28 Correct 7 ms 376 KB Output is correct
29 Correct 6 ms 376 KB Output is correct
30 Correct 5 ms 376 KB Output is correct
31 Correct 7 ms 376 KB Output is correct
32 Correct 6 ms 376 KB Output is correct
33 Correct 6 ms 376 KB Output is correct
34 Correct 6 ms 376 KB Output is correct
35 Correct 6 ms 376 KB Output is correct
36 Correct 10 ms 376 KB Output is correct
37 Correct 16 ms 376 KB Output is correct
38 Correct 23 ms 376 KB Output is correct
39 Correct 23 ms 376 KB Output is correct
40 Correct 5 ms 376 KB Output is correct
41 Correct 17 ms 376 KB Output is correct
42 Correct 21 ms 376 KB Output is correct
43 Correct 6 ms 376 KB Output is correct
44 Correct 8 ms 376 KB Output is correct
45 Correct 14 ms 376 KB Output is correct
46 Correct 18 ms 376 KB Output is correct
47 Correct 18 ms 376 KB Output is correct
48 Correct 5 ms 424 KB Output is correct
49 Correct 19 ms 376 KB Output is correct
50 Correct 19 ms 380 KB Output is correct
51 Correct 9 ms 376 KB Output is correct
52 Correct 541 ms 3064 KB Output is correct
53 Execution timed out 1082 ms 4728 KB Time limit exceeded
54 Halted 0 ms 0 KB -