답안 #48254

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
48254 2018-05-11T06:01:28 Z arman_ferdous Bali Sculptures (APIO15_sculpture) C++17
0 / 100
24 ms 32112 KB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
const int N = 2010;
const ll INF = 1e18+7e17;

int n, k, A, B;
ll arr[N], sum[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]);
		sum[i] = sum[i-1] + arr[i];
		dp[i][1] = sum[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]|(sum[i] - sum[p])),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:15: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:17:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lld", &arr[i]);
   ~~~~~^~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 23 ms 31992 KB Output is correct
2 Incorrect 22 ms 32104 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 22 ms 32104 KB Output is correct
2 Incorrect 24 ms 32104 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 23 ms 32104 KB Output is correct
2 Incorrect 23 ms 32104 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 24 ms 32112 KB Output is correct
2 Incorrect 22 ms 32112 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 22 ms 32112 KB Output is correct
2 Incorrect 23 ms 32112 KB Output isn't correct
3 Halted 0 ms 0 KB -