Submission #41518

# Submission time Handle Problem Language Result Execution time Memory
41518 2018-02-18T04:33:17 Z wzy Bali Sculptures (APIO15_sculpture) C++14
0 / 100
41 ms 49668 KB
#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

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 time Memory Grader output
1 Correct 38 ms 49192 KB Output is correct
2 Correct 38 ms 49376 KB Output is correct
3 Incorrect 40 ms 49452 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 37 ms 49452 KB Output is correct
2 Correct 38 ms 49452 KB Output is correct
3 Incorrect 37 ms 49452 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 38 ms 49460 KB Output is correct
2 Correct 37 ms 49500 KB Output is correct
3 Incorrect 37 ms 49504 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 37 ms 49552 KB Output is correct
2 Correct 37 ms 49552 KB Output is correct
3 Incorrect 41 ms 49552 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 37 ms 49668 KB Output is correct
2 Correct 37 ms 49668 KB Output is correct
3 Incorrect 37 ms 49668 KB Output isn't correct
4 Halted 0 ms 0 KB -