Submission #40901

# Submission time Handle Problem Language Result Execution time Memory
40901 2018-02-09T22:26:38 Z IvanC Bali Sculptures (APIO15_sculpture) C++14
16 / 100
131 ms 37992 KB
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 101;
const int MAXOR = 4096;
int dp[MAXN][MAXN][MAXOR],best,N,A,B,soma[MAXN];
int calc(int a,int b){return soma[b] - soma[a-1];}
void solve(int pos,int resta,int curOr){
	if(dp[pos][resta][curOr]) return;
	dp[pos][resta][curOr] = 1;
	if(pos == N + 1){
		if(resta != 0) return;
		best = min(best,curOr);
		return;
	}
	if(resta == 0) return;
	for(int quebra = pos;quebra<=N;quebra++){
		solve(quebra+1,resta - 1,curOr | calc(pos,quebra));
	}
}
int main(){
	scanf("%d %d %d",&N,&A,&B);
	for(int i = 1;i<=N;i++){
		scanf("%d",&soma[i]);
		soma[i] += soma[i-1];
	}
	best = MAXOR;
	for(int i = A;i<=B;i++) solve(1,i,0);
	printf("%d\n",best);
	return 0;
}

Compilation message

sculpture.cpp: In function 'int main()':
sculpture.cpp:21:28: 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:23:23: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d",&soma[i]);
                       ^
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 612 KB Output is correct
3 Correct 2 ms 612 KB Output is correct
4 Correct 2 ms 612 KB Output is correct
5 Correct 2 ms 704 KB Output is correct
6 Correct 2 ms 1708 KB Output is correct
7 Correct 2 ms 1708 KB Output is correct
8 Correct 2 ms 1708 KB Output is correct
9 Correct 2 ms 1708 KB Output is correct
10 Correct 2 ms 1708 KB Output is correct
11 Correct 2 ms 1708 KB Output is correct
12 Correct 2 ms 1708 KB Output is correct
13 Correct 3 ms 2304 KB Output is correct
14 Correct 2 ms 2304 KB Output is correct
15 Correct 2 ms 2304 KB Output is correct
16 Correct 2 ms 2304 KB Output is correct
17 Correct 2 ms 2304 KB Output is correct
18 Correct 2 ms 2304 KB Output is correct
19 Correct 2 ms 2304 KB Output is correct
20 Correct 2 ms 2304 KB Output is correct
21 Correct 2 ms 2304 KB Output is correct
22 Correct 2 ms 2304 KB Output is correct
23 Correct 2 ms 2304 KB Output is correct
24 Correct 2 ms 2304 KB Output is correct
25 Correct 2 ms 2304 KB Output is correct
26 Correct 3 ms 2304 KB Output is correct
27 Runtime error 4 ms 2304 KB Execution killed with signal 11 (could be triggered by violating memory limits)
28 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2304 KB Output is correct
2 Correct 2 ms 2304 KB Output is correct
3 Correct 1 ms 2304 KB Output is correct
4 Correct 1 ms 2304 KB Output is correct
5 Correct 2 ms 2304 KB Output is correct
6 Correct 2 ms 2304 KB Output is correct
7 Correct 2 ms 2304 KB Output is correct
8 Correct 2 ms 2304 KB Output is correct
9 Correct 2 ms 2304 KB Output is correct
10 Correct 3 ms 2304 KB Output is correct
11 Correct 2 ms 2304 KB Output is correct
12 Correct 2 ms 2304 KB Output is correct
13 Correct 3 ms 2524 KB Output is correct
14 Correct 2 ms 2524 KB Output is correct
15 Correct 2 ms 2524 KB Output is correct
16 Correct 2 ms 2524 KB Output is correct
17 Correct 2 ms 2524 KB Output is correct
18 Correct 2 ms 2524 KB Output is correct
19 Correct 2 ms 2524 KB Output is correct
20 Correct 2 ms 2524 KB Output is correct
21 Correct 3 ms 2524 KB Output is correct
22 Correct 2 ms 2524 KB Output is correct
23 Correct 2 ms 2524 KB Output is correct
24 Correct 2 ms 2524 KB Output is correct
25 Correct 2 ms 2524 KB Output is correct
26 Correct 3 ms 2524 KB Output is correct
27 Correct 4 ms 3508 KB Output is correct
28 Correct 3 ms 3508 KB Output is correct
29 Correct 3 ms 3508 KB Output is correct
30 Correct 8 ms 6160 KB Output is correct
31 Correct 14 ms 8120 KB Output is correct
32 Correct 12 ms 8120 KB Output is correct
33 Correct 2 ms 8120 KB Output is correct
34 Correct 11 ms 8120 KB Output is correct
35 Correct 10 ms 8120 KB Output is correct
36 Correct 7 ms 8120 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 8120 KB Output is correct
2 Correct 2 ms 8120 KB Output is correct
3 Correct 2 ms 8120 KB Output is correct
4 Correct 2 ms 8120 KB Output is correct
5 Correct 2 ms 8120 KB Output is correct
6 Correct 2 ms 8120 KB Output is correct
7 Correct 2 ms 8120 KB Output is correct
8 Correct 2 ms 8120 KB Output is correct
9 Correct 2 ms 8120 KB Output is correct
10 Correct 2 ms 8120 KB Output is correct
11 Correct 2 ms 8120 KB Output is correct
12 Correct 2 ms 8120 KB Output is correct
13 Correct 3 ms 8120 KB Output is correct
14 Correct 4 ms 8120 KB Output is correct
15 Correct 3 ms 8120 KB Output is correct
16 Correct 3 ms 8120 KB Output is correct
17 Correct 8 ms 8120 KB Output is correct
18 Correct 13 ms 8216 KB Output is correct
19 Correct 11 ms 8216 KB Output is correct
20 Correct 2 ms 8216 KB Output is correct
21 Correct 12 ms 8216 KB Output is correct
22 Correct 10 ms 8216 KB Output is correct
23 Correct 6 ms 8216 KB Output is correct
24 Correct 12 ms 8216 KB Output is correct
25 Correct 9 ms 8216 KB Output is correct
26 Correct 36 ms 13112 KB Output is correct
27 Correct 131 ms 37992 KB Output is correct
28 Runtime error 11 ms 37992 KB Execution killed with signal 11 (could be triggered by violating memory limits)
29 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 37992 KB Output is correct
2 Correct 2 ms 37992 KB Output is correct
3 Correct 2 ms 37992 KB Output is correct
4 Correct 2 ms 37992 KB Output is correct
5 Correct 2 ms 37992 KB Output is correct
6 Correct 2 ms 37992 KB Output is correct
7 Correct 2 ms 37992 KB Output is correct
8 Correct 2 ms 37992 KB Output is correct
9 Correct 2 ms 37992 KB Output is correct
10 Correct 2 ms 37992 KB Output is correct
11 Correct 2 ms 37992 KB Output is correct
12 Correct 2 ms 37992 KB Output is correct
13 Correct 3 ms 37992 KB Output is correct
14 Correct 2 ms 37992 KB Output is correct
15 Correct 2 ms 37992 KB Output is correct
16 Correct 2 ms 37992 KB Output is correct
17 Correct 2 ms 37992 KB Output is correct
18 Correct 2 ms 37992 KB Output is correct
19 Correct 2 ms 37992 KB Output is correct
20 Correct 2 ms 37992 KB Output is correct
21 Correct 2 ms 37992 KB Output is correct
22 Correct 2 ms 37992 KB Output is correct
23 Correct 2 ms 37992 KB Output is correct
24 Correct 2 ms 37992 KB Output is correct
25 Correct 2 ms 37992 KB Output is correct
26 Correct 3 ms 37992 KB Output is correct
27 Runtime error 6 ms 37992 KB Execution killed with signal 11 (could be triggered by violating memory limits)
28 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 37992 KB Output is correct
2 Correct 1 ms 37992 KB Output is correct
3 Correct 2 ms 37992 KB Output is correct
4 Correct 2 ms 37992 KB Output is correct
5 Correct 2 ms 37992 KB Output is correct
6 Correct 2 ms 37992 KB Output is correct
7 Correct 2 ms 37992 KB Output is correct
8 Correct 2 ms 37992 KB Output is correct
9 Correct 2 ms 37992 KB Output is correct
10 Correct 2 ms 37992 KB Output is correct
11 Correct 2 ms 37992 KB Output is correct
12 Correct 2 ms 37992 KB Output is correct
13 Correct 3 ms 37992 KB Output is correct
14 Runtime error 5 ms 37992 KB Execution killed with signal 11 (could be triggered by violating memory limits)
15 Halted 0 ms 0 KB -