Submission #41519

#TimeUsernameProblemLanguageResultExecution timeMemory
41519wzyBali Sculptures (APIO15_sculpture)C++14
21 / 100
3 ms992 KiB
#include <bits/stdc++.h>
using namespace std;
#define int long long
int y[2500] , dp[150][150];
int n ,  a ,b;

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


int32_t 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];
		}
		for(int i = 0 ; i < 150 ; i++){
			for(int j = 0 ; j  < 150 ; j++) dp[i][j] = -1;
		}
		printf("%lld\n" , solve(1,0));
	
}	

Compilation message (stderr)

sculpture.cpp: In function 'int32_t main()':
sculpture.cpp:22: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:26: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...