Submission #41518

#TimeUsernameProblemLanguageResultExecution timeMemory
41518wzyBali Sculptures (APIO15_sculpture)C++14
0 / 100
41 ms49668 KiB
#include <bits/stdc++.h>
using namespace std;
long long y[2500] , dp[2500][2500] , dp2[105][105];
long long n ,  a ,b;

long long solve(long long i , long long j){
	if(i == n + 1){
	if(j >= a && j <= b) return 0;
	else return ((1LL<<31) - 1);
	}
	if(dp[i][j] != -1) return dp[i][j];
	dp[i][j] = (long long) 1e18;
	for(int w = i ; w <= n; w++){
		dp[i][j] = min((solve(w + 1 , j + 1) )|(y[w] - y[i-1]) , dp[i][j]);
	}
	return dp[i][j];
}


int main(){
	scanf("%lld%lld%lld" , &n , &a , &b);
	y[0] = 0;

		for(int i = 1 ; i <= n; i++){
			scanf("%lld" , & y[i]);
			y[i] += y[i-1];
		}
		memset(dp, -1 , sizeof dp);
		printf("%lld\n" , solve(1,1));
	
}	

Compilation message (stderr)

sculpture.cpp: In function 'int main()':
sculpture.cpp:21:38: 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:25:26: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    scanf("%lld" , & y[i]);
                          ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...