# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
45760 | antimirage | Bali Sculptures (APIO15_sculpture) | C++17 | 1111 ms | 262144 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define fr first
#define sc second
#define mk make_pair
#define pb push_back
#define OK puts("OK");
#define sz(s) (int)s.size()
#define all(s) s.begin(), s.end()
using namespace std;
const int N = 2005, inf = 1e18;
int n, a, b, ar[N];
long long pref[N], ans = 1e18;
vector <long long> dp[N][N];
main()
{
cin >> n >> a >> b;
for (int i = 1; i <= n; i++)
scanf("%d", &ar[i]), pref[i] = ar[i] + pref[i - 1];
dp[0][0].push_back( 0 );
for (int i = 1; i <= n; i++)
{
for (int j = 1; j <= n; j++)
{
for (int k = 1; k <= j; k++)
{
for (auto it : dp[i - 1][k - 1])
dp[i][j].push_back( it | (pref[j] - pref[k - 1]) );
}
}
}
for (int i = a; i <= b; i++)
{
sort(all(dp[i][n]));
ans = min(ans, dp[i][n][0]);
}
cout << ans << endl;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |