Submission #563436

# Submission time Handle Problem Language Result Execution time Memory
563436 2022-05-17T08:00:12 Z penguin133 Bali Sculptures (APIO15_sculpture) C++14
0 / 100
1 ms 372 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
int A[200005] ,P[200005];
int n,a,b;
int dp[105][105][105];
int calc(int i, int k, int prev){
	if(i == n + 1 && !k)return P[i-1] - P[prev];
	else if(i == n + 1)return 1e18;
	else if(dp[i][k][prev])return dp[i][k][prev];
	else if(k)return dp[i][k][prev] = min((calc(i+1, k-1, i) | (P[i] - P[prev])), calc(i+1, k, prev));
	else return dp[i][k][prev] = calc(i+1, k, prev);
}
main(){
	ios::sync_with_stdio(0);cin.tie(0);
	cin >> n >> a >> b;
	for(int i=1;i<=n;i++)cin >> A[i], P[i] = P[i-1] + A[i];
	int ans = 1e18;
	for(int i=a;i<=b;i++)ans = min(ans, calc(1, i, 0));
	cout << ans;
}

Compilation message

sculpture.cpp:14:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   14 | main(){
      | ^~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 1 ms 328 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Incorrect 1 ms 328 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 1 ms 308 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Incorrect 1 ms 324 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Incorrect 1 ms 340 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 372 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 1 ms 328 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Incorrect 1 ms 340 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 1 ms 328 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Incorrect 1 ms 320 KB Output isn't correct
6 Halted 0 ms 0 KB -