Submission #39886

# Submission time Handle Problem Language Result Execution time Memory
39886 2018-01-23T13:42:28 Z ddokddogi Bali Sculptures (APIO15_sculpture) C++11
0 / 100
0 ms 2116 KB
#include <bits/stdc++.h>
using namespace std;

typedef long long lld;
lld dp[110][110], n, a, b, num[110], dap=LONG_LONG_MAX, sum[110];

int main(){
	//freopen("input.txt", "r", stdin);
	lld i, j, k;
	scanf("%lld%lld%lld",&n,&a,&b);
	for(i=1;i<=n;i++){scanf("%lld", &num[i]);sum[i]=sum[i-1]+num[i];}
	for(i=1;i<=n;i++)for(j=1;j<=n;j++)dp[i][j]=LONG_LONG_MAX;
	for(i=1;i<=n;i++)dp[1][i]=sum[i];
	for(i=2;i<=n;i++){
		for(j=i;j<=n;j++){
			for(k=i-1;k<j;k++){
				dp[i][j] = min(dp[i][j], (dp[i-1][k]|(sum[j]-sum[k])));
			}
		}
	}
	for(i=a;i<=b;i++) dap = min(dap, dp[i][n]);
	printf("%lld", dap);
}

Compilation message

sculpture.cpp: In function 'int main()':
sculpture.cpp:10:32: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld%lld%lld",&n,&a,&b);
                                ^
sculpture.cpp:11:42: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(i=1;i<=n;i++){scanf("%lld", &num[i]);sum[i]=sum[i-1]+num[i];}
                                          ^
# Verdict Execution time Memory Grader output
1 Correct 0 ms 2116 KB Output is correct
2 Incorrect 0 ms 2116 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 2116 KB Output is correct
2 Incorrect 0 ms 2116 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 2116 KB Output is correct
2 Incorrect 0 ms 2116 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 2116 KB Output is correct
2 Incorrect 0 ms 2116 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 2116 KB Output is correct
2 Incorrect 0 ms 2116 KB Output isn't correct
3 Halted 0 ms 0 KB -