Submission #48282

# Submission time Handle Problem Language Result Execution time Memory
48282 2018-05-11T10:58:05 Z arman_ferdous Bali Sculptures (APIO15_sculpture) C++11
0 / 100
27 ms 32252 KB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
const int N = 2010;
const ll INF = 4e17;

int n, k, A, B;
ll arr[N], c[N][N], dp[N][N];

int main() {
	for(int i = 0; i < N; i++)
		for(int j = 0; j < N; j++)
			dp[i][j] = INF;

	scanf("%d %d %d", &n, &A, &B);

	for(int i = 1; i <= n; i++) 
		scanf("%lld", &arr[i]);

	for(int i = 1; i <= n; i++) {
		c[i][i] = arr[i];
		for(int j = i+1; j <= n; j++) 
			c[i][j] = c[i][j-1] + arr[j];
	}
	for(int i = 1; i <= n; i++)
		dp[i][1] = c[1][i];

	for(int j = 2; j <= B; j++) 
		for(int i = 1; i <= n; i++)
			for(int p = 1; p < i; p++)
				dp[i][j] = min((dp[p][j-1]|c[p+1][i]), dp[i][j]);
	ll ans = INF;
	for(int i = A; i <= B; i++)
		ans = min(ans, dp[n][i]);
	printf("%lld\n", ans);
	return 0;
}

Compilation message

sculpture.cpp: In function 'int main()':
sculpture.cpp:16:7: 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:19:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lld", &arr[i]);
   ~~~~~^~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 23 ms 31996 KB Output is correct
2 Incorrect 27 ms 31996 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 22 ms 32024 KB Output is correct
2 Incorrect 23 ms 32072 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 23 ms 32076 KB Output is correct
2 Incorrect 23 ms 32252 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 22 ms 32252 KB Output is correct
2 Incorrect 22 ms 32252 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 23 ms 32252 KB Output is correct
2 Incorrect 22 ms 32252 KB Output isn't correct
3 Halted 0 ms 0 KB -