Submission #112525

# Submission time Handle Problem Language Result Execution time Memory
112525 2019-05-20T12:07:07 Z TuGSGeReL Bali Sculptures (APIO15_sculpture) C++17
0 / 100
2 ms 384 KB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

#define ll long long
#define mp make_pair
#define pub push_back
#define pob pop_back()
#define ss second
#define ff first
#define mt make_tuple
#define pof pop_front()
#define fbo find_by_order
#define ook order_of_key
#define lb lower_bound
#define ub upper_bound

typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
using pll = pair <ll, ll>;
using pii = pair <int, int>;

ll n, a, b, x[2001], dp[2001][2001], ans = 1e18;

int main ()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	
	cin >> n >> a >> b;
	
	for (int i = 1; i <= n; i++)
	{
		cin >> x[i];
		x[i] += x[i - 1];
		dp[1][i] = x[i];
	}
	
	for (int i = 2; i <= b; i++)
		for (int j = 1; j <= n; j++)
			dp[i][j] = 1e18;
	
	for (int i = 2; i <= b; i++)
		for (int j = 1; j <= n; j++)
			for (int k = i - 1; k < j; k++)
				dp[i][j] = min(dp[i][j], (dp[i - 1][k] | (x[j] - x[k])));
	
	for (int i = a; i <= b; i++)
		ans = min(ans, dp[i][n]);
	
	cout << ans;
}
/*
6 1 3 
8 1 2 1 5 4
*/
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Incorrect 2 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Incorrect 2 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Incorrect 2 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Incorrect 2 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Incorrect 2 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -