Submission #15870

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

#define MAXN 2003
typedef long long lld;

int N, A, B;
int X[MAXN], D[MAXN], E[MAXN];
lld S[MAXN];
bool w[MAXN][MAXN];

int main()
{
	scanf("%d%d%d", &N, &A, &B);
	for (int i=1;i<=N;i++) scanf("%d", X+i), S[i] = S[i-1] + X[i];
	lld msk = 0;
	for (int b=40;b>=0;b--){
		for (int i=0;i<N;i++) for (int j=i+1;j<=N;j++){
			w[i][j] = (((S[j]-S[i]) >> b) | msk) == msk;
		}
		D[0] = E[0] = 0;
		for (int i=1;i<=N;i++){
			D[i] = 2e9; E[i] = -2e9;
			for (int j=0;j<i;j++) if (w[j][i]){
				if (D[j] >= 0) D[i] = min(D[i], D[j]+1);
				if (E[j] < 2e9) E[i] = max(E[i], E[j]+1);
			}
		}
		if (D[N] <= B || E[N] >= A);
		else msk++;
		if (b) msk <<= 1;
	}
	printf("%lld\n", msk);
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 5680 KB Output is correct
2 Correct 0 ms 5680 KB Output is correct
3 Correct 0 ms 5680 KB Output is correct
4 Correct 0 ms 5680 KB Output is correct
5 Incorrect 0 ms 5680 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 5680 KB Output is correct
2 Correct 0 ms 5680 KB Output is correct
3 Correct 0 ms 5680 KB Output is correct
4 Correct 0 ms 5680 KB Output is correct
5 Incorrect 0 ms 5680 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 5680 KB Output is correct
2 Correct 0 ms 5680 KB Output is correct
3 Correct 0 ms 5680 KB Output is correct
4 Correct 0 ms 5680 KB Output is correct
5 Incorrect 0 ms 5680 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 5680 KB Output is correct
2 Correct 0 ms 5680 KB Output is correct
3 Correct 0 ms 5680 KB Output is correct
4 Correct 0 ms 5680 KB Output is correct
5 Incorrect 0 ms 5680 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 5680 KB Output is correct
2 Correct 0 ms 5680 KB Output is correct
3 Correct 0 ms 5680 KB Output is correct
4 Correct 0 ms 5680 KB Output is correct
5 Incorrect 0 ms 5680 KB Output isn't correct
6 Halted 0 ms 0 KB -