Submission #743281

# Submission time Handle Problem Language Result Execution time Memory
743281 2023-05-17T09:26:02 Z Magikarp4000 Bali Sculptures (APIO15_sculpture) C++17
0 / 100
1 ms 468 KB
#include <bits/stdc++.h>
using namespace std;
#define OPTM ios_base::sync_with_stdio(0); cin.tie(0);
#define INF int(1e9+7)
#define ln '\n' 
#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define us unsigned short
#define FOR(i,s,n) for (int i = s; i < n; i++)
#define FORR(i,n,s) for (int i = n; i > s; i--)
#define FORX(u, arr) for (auto u : arr)
#define PB push_back
#define in(v,x) (v.find(x) != v.end())
#define F first
#define S second
#define PII pair<int, int>
#define PLL pair<ll, ll>
#define UM unordered_map
#define US unordered_set
#define PQ priority_queue
#define ALL(v) v.begin(), v.end()
const ll LLINF = 1e18+1;
#define int long long

const int MAXN = 1e2+1;
int n,A,B;
int a[MAXN], p[MAXN];
int dp[MAXN][MAXN][MAXN];

signed main() {
    cin >> n >> A >> B;
    FOR(i,0,n) cin >> a[i];
    FOR(i,1,n+1) p[i] = p[i-1]+a[i-1];
    FOR(i,0,n+1) FOR(j,0,n+1) FOR(k,0,n+1) dp[i][j][k] = LLINF;
    FOR(j,0,n) dp[0][j][0] = p[j+1]-p[0];
    FOR(k,1,n) {
        FOR(i,0,n) {
            FOR(j,i,n) {
                int sum = p[j+1]-p[i];
                FOR(l,0,i) {
                    dp[i][j][k] = min(dp[i][j][k], dp[l][i-1][k-1] | sum);
                }
            }
        }
    }
    int res = LLINF;
    FOR(x,A-1,B) {
        FOR(i,0,n) res = min(res, dp[i][n-1][x]);
    }
    cout << res;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 436 KB Output is correct
6 Incorrect 1 ms 468 KB Output isn't correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 304 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Incorrect 1 ms 468 KB Output isn't correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 352 KB Output is correct
3 Correct 1 ms 304 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Incorrect 1 ms 468 KB Output isn't correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 304 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 304 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Incorrect 1 ms 468 KB Output isn't correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 312 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Incorrect 1 ms 468 KB Output isn't correct
7 Halted 0 ms 0 KB -