Submission #15867

# Submission time Handle Problem Language Result Execution time Memory
15867 2015-07-31T17:21:02 Z myungwoo Bali Sculptures (APIO15_sculpture) C++14
0 / 100
0 ms 33072 KB
#include <bits/stdc++.h>
using namespace std;

#define MAXN 2003
typedef long long lld;

int N, A, B;
int X[MAXN];
lld D[MAXN][MAXN];

int main()
{
	scanf("%d%d%d", &N, &A, &B);
	for (int i=1;i<=N;i++) scanf("%d", X+i);
	for (int i=1;i<=N;i++) D[1][i] = D[1][i-1] + X[i];
	for (int i=2;i<=B;i++){
		for (int j=i;j<=N;j++){
			lld sum = X[j];
			D[i][j] = 1e18;
			for (int k=j-1;k>=i-1;k--){
				D[i][j] = min(D[i][j], D[i-1][k] | sum);
				sum += X[j];
			}
		}
	}
	lld ans = 1e18;
	for (int i=A;i<=B;i++) ans = min(ans, D[i][N]);
	printf("%lld\n", ans);
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 33072 KB Output is correct
2 Correct 0 ms 33072 KB Output is correct
3 Correct 0 ms 33072 KB Output is correct
4 Correct 0 ms 33072 KB Output is correct
5 Correct 0 ms 33072 KB Output is correct
6 Incorrect 0 ms 33072 KB Output isn't correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 33072 KB Output is correct
2 Correct 0 ms 33072 KB Output is correct
3 Correct 0 ms 33072 KB Output is correct
4 Correct 0 ms 33072 KB Output is correct
5 Correct 0 ms 33072 KB Output is correct
6 Incorrect 0 ms 33072 KB Output isn't correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 33072 KB Output is correct
2 Correct 0 ms 33072 KB Output is correct
3 Correct 0 ms 33072 KB Output is correct
4 Correct 0 ms 33072 KB Output is correct
5 Correct 0 ms 33072 KB Output is correct
6 Incorrect 0 ms 33072 KB Output isn't correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 33072 KB Output is correct
2 Correct 0 ms 33072 KB Output is correct
3 Correct 0 ms 33072 KB Output is correct
4 Correct 0 ms 33072 KB Output is correct
5 Correct 0 ms 33072 KB Output is correct
6 Incorrect 0 ms 33072 KB Output isn't correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 33072 KB Output is correct
2 Correct 0 ms 33072 KB Output is correct
3 Correct 0 ms 33072 KB Output is correct
4 Correct 0 ms 33072 KB Output is correct
5 Correct 0 ms 33072 KB Output is correct
6 Incorrect 0 ms 33072 KB Output isn't correct
7 Halted 0 ms 0 KB -