Submission #104756

# Submission time Handle Problem Language Result Execution time Memory
104756 2019-04-09T06:41:04 Z ekrem Bali Sculptures (APIO15_sculpture) C++
0 / 100
3 ms 512 KB
#include <bits/stdc++.h>
#define st first
#define nd second
#define mp make_pair
#define pb push_back
#define inf 1000000007
#define N 2005
using namespace std;

typedef long long ll;

ll n, x, y, ans = inf, a[N], pre[N], dp[N][N];

int main() {
	// freopen("in.txt", "r", stdin);
	// freopen("out.txt", "w", stdout);
	scanf("%lld %lld %lld",&n ,&x ,&y);
	for(int i = 1; i <= n; i++){
		scanf("%lld",a + i);
		pre[i] = pre[i - 1] + a[i];
	}

	for(int i = 1; i <= n; i++){
		dp[i][0] = inf;
		dp[0][i] = inf;
	}

	for(int i = 1; i <= n; i++)
		for(int k = 1; k <= n; k++){
			dp[i][k] = inf;
			for(int j = i; j >= 1; j--)
				dp[i][k] = min(dp[i][k], ((pre[i] - pre[j - 1])|dp[j - 1][k - 1]) );
			// cout << i << " " << k << " -> " << dp[i][k] << endl;
		}
	for(int i = x; i <= y; i++)
		ans = min(ans, dp[n][i]);
	printf("%lld\n", ans);
	return 0;
}

Compilation message

sculpture.cpp: In function 'int main()':
sculpture.cpp:17:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld %lld %lld",&n ,&x ,&y);
  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sculpture.cpp:19:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lld",a + i);
   ~~~~~^~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 3 ms 384 KB Output is correct
2 Incorrect 3 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 384 KB Output is correct
2 Incorrect 3 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 512 KB Output is correct
2 Incorrect 3 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Incorrect 2 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Incorrect 2 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -