답안 #482675

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
482675 2021-10-26T03:18:38 Z jalsol Bali Sculptures (APIO15_sculpture) C++17
21 / 100
450 ms 31820 KB
#ifdef LOCAL
#include "local.h"
#else
#include <bits/stdc++.h>
#define debug(...)
#define DB(...)
#endif

using namespace std;

const bool __initialization = []() {
    cin.tie(nullptr)->sync_with_stdio(false);
#define TASK "empty"
    if (fopen(TASK".inp", "r")) {
        (void)(!freopen(TASK".inp", "r", stdin));
        (void)(!freopen(TASK".out", "w", stdout)); }
    cout << setprecision(12) << fixed;
    return true;
}();

using ll = long long;
using ld = long double;

#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

#define For(i, l, r) for (int i = (l); i <= (r); ++i)
#define Ford(i, r, l) for (int i = (r); i >= (l); --i)
#define Rep(i, n) For (i, 0, (n) - 1)
#define Repd(i, n) Ford (i, (n) - 1, 0)
#define Fe(...) for (auto __VA_ARGS__)

template <class C> inline int isz(const C& c) { return static_cast<int>(c.size()); }
template <class T> inline bool chmin(T& a, const T& b) { return (a > b) ? a = b, true : false; }
template <class T> inline bool chmax(T& a, const T& b) { return (a < b) ? a = b, true : false; }

constexpr ld eps = 1e-9;
constexpr int inf = 1e9;
constexpr ll linf = 1e18;

// =============================================================================

constexpr int maxn = 2000 + 5;

ll myinf;

int n, lo, hi;
int a[maxn];
ll pref[maxn];

ll dp[maxn][maxn];

ll go(int i, int rem) {
    if (i == n + 1) return rem == 0 ? 0 : myinf;
    if (rem == 0) return myinf;

    ll& ret = dp[i][rem];
    if (ret != -1) return ret;

    ret = myinf;

    For (j, i, n) {
        chmin(ret, go(j + 1, rem - 1) | (pref[j] - pref[i - 1]));
    }

    return ret;
}

signed main() {
    Rep (i, 41) myinf |= (1LL << i);

    cin >> n >> lo >> hi;
    For (i, 1, n) cin >> a[i];

    For (i, 1, n) {
        pref[i] = pref[i - 1] + a[i];
    }

    ll ans = myinf;

    For (i, lo, hi) {
        memset(dp, -1, sizeof(dp));
        chmin(ans, go(1, i));
    }

    cout << ans << '\n';
}
# 결과 실행 시간 메모리 Grader output
1 Correct 21 ms 31692 KB Output is correct
2 Correct 24 ms 31692 KB Output is correct
3 Correct 12 ms 31684 KB Output is correct
4 Correct 20 ms 31700 KB Output is correct
5 Correct 13 ms 31692 KB Output is correct
6 Correct 64 ms 31692 KB Output is correct
7 Correct 20 ms 31792 KB Output is correct
8 Correct 21 ms 31788 KB Output is correct
9 Correct 24 ms 31772 KB Output is correct
10 Correct 20 ms 31728 KB Output is correct
11 Correct 13 ms 31672 KB Output is correct
12 Correct 20 ms 31720 KB Output is correct
13 Correct 71 ms 31692 KB Output is correct
14 Correct 17 ms 31692 KB Output is correct
15 Correct 13 ms 31692 KB Output is correct
16 Correct 27 ms 31788 KB Output is correct
17 Correct 17 ms 31708 KB Output is correct
18 Correct 26 ms 31676 KB Output is correct
19 Correct 14 ms 31692 KB Output is correct
20 Correct 14 ms 31692 KB Output is correct
21 Incorrect 24 ms 31820 KB Output isn't correct
22 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 21 ms 31692 KB Output is correct
2 Correct 27 ms 31792 KB Output is correct
3 Correct 14 ms 31692 KB Output is correct
4 Correct 21 ms 31692 KB Output is correct
5 Correct 16 ms 31720 KB Output is correct
6 Correct 66 ms 31772 KB Output is correct
7 Correct 20 ms 31784 KB Output is correct
8 Correct 22 ms 31676 KB Output is correct
9 Correct 22 ms 31692 KB Output is correct
10 Correct 20 ms 31692 KB Output is correct
11 Correct 15 ms 31692 KB Output is correct
12 Correct 22 ms 31696 KB Output is correct
13 Correct 83 ms 31768 KB Output is correct
14 Correct 18 ms 31748 KB Output is correct
15 Correct 14 ms 31728 KB Output is correct
16 Correct 25 ms 31680 KB Output is correct
17 Correct 16 ms 31708 KB Output is correct
18 Correct 20 ms 31692 KB Output is correct
19 Correct 13 ms 31692 KB Output is correct
20 Correct 14 ms 31684 KB Output is correct
21 Incorrect 24 ms 31784 KB Output isn't correct
22 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 27 ms 31792 KB Output is correct
2 Correct 24 ms 31692 KB Output is correct
3 Correct 13 ms 31688 KB Output is correct
4 Correct 24 ms 31708 KB Output is correct
5 Correct 14 ms 31692 KB Output is correct
6 Correct 66 ms 31820 KB Output is correct
7 Correct 27 ms 31792 KB Output is correct
8 Correct 21 ms 31692 KB Output is correct
9 Correct 21 ms 31792 KB Output is correct
10 Correct 20 ms 31792 KB Output is correct
11 Correct 14 ms 31692 KB Output is correct
12 Correct 21 ms 31792 KB Output is correct
13 Correct 74 ms 31772 KB Output is correct
14 Correct 81 ms 31692 KB Output is correct
15 Correct 45 ms 31768 KB Output is correct
16 Correct 28 ms 31792 KB Output is correct
17 Correct 72 ms 31692 KB Output is correct
18 Correct 88 ms 31692 KB Output is correct
19 Correct 79 ms 31692 KB Output is correct
20 Correct 12 ms 31780 KB Output is correct
21 Correct 92 ms 31780 KB Output is correct
22 Correct 74 ms 31692 KB Output is correct
23 Correct 45 ms 31664 KB Output is correct
24 Correct 81 ms 31768 KB Output is correct
25 Correct 53 ms 31692 KB Output is correct
26 Correct 98 ms 31692 KB Output is correct
27 Correct 225 ms 31772 KB Output is correct
28 Correct 432 ms 31776 KB Output is correct
29 Correct 443 ms 31692 KB Output is correct
30 Correct 13 ms 31692 KB Output is correct
31 Correct 201 ms 31692 KB Output is correct
32 Correct 318 ms 31772 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 19 ms 31692 KB Output is correct
2 Correct 24 ms 31692 KB Output is correct
3 Correct 14 ms 31748 KB Output is correct
4 Correct 26 ms 31688 KB Output is correct
5 Correct 19 ms 31768 KB Output is correct
6 Correct 69 ms 31736 KB Output is correct
7 Correct 20 ms 31692 KB Output is correct
8 Correct 21 ms 31792 KB Output is correct
9 Correct 21 ms 31672 KB Output is correct
10 Correct 21 ms 31692 KB Output is correct
11 Correct 14 ms 31692 KB Output is correct
12 Correct 27 ms 31792 KB Output is correct
13 Correct 78 ms 31676 KB Output is correct
14 Correct 21 ms 31692 KB Output is correct
15 Correct 14 ms 31756 KB Output is correct
16 Correct 23 ms 31676 KB Output is correct
17 Correct 16 ms 31692 KB Output is correct
18 Correct 20 ms 31784 KB Output is correct
19 Correct 13 ms 31712 KB Output is correct
20 Correct 13 ms 31692 KB Output is correct
21 Incorrect 24 ms 31788 KB Output isn't correct
22 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 20 ms 31724 KB Output is correct
2 Correct 24 ms 31788 KB Output is correct
3 Correct 18 ms 31712 KB Output is correct
4 Correct 23 ms 31760 KB Output is correct
5 Correct 17 ms 31728 KB Output is correct
6 Correct 66 ms 31776 KB Output is correct
7 Correct 19 ms 31692 KB Output is correct
8 Correct 20 ms 31692 KB Output is correct
9 Correct 19 ms 31728 KB Output is correct
10 Correct 20 ms 31768 KB Output is correct
11 Correct 13 ms 31680 KB Output is correct
12 Correct 21 ms 31788 KB Output is correct
13 Correct 73 ms 31776 KB Output is correct
14 Correct 25 ms 31692 KB Output is correct
15 Correct 26 ms 31720 KB Output is correct
16 Correct 59 ms 31692 KB Output is correct
17 Correct 20 ms 31692 KB Output is correct
18 Correct 34 ms 31692 KB Output is correct
19 Correct 12 ms 31692 KB Output is correct
20 Correct 56 ms 31692 KB Output is correct
21 Correct 81 ms 31768 KB Output is correct
22 Correct 20 ms 31724 KB Output is correct
23 Correct 80 ms 31692 KB Output is correct
24 Correct 84 ms 31772 KB Output is correct
25 Correct 46 ms 31692 KB Output is correct
26 Correct 28 ms 31692 KB Output is correct
27 Correct 74 ms 31672 KB Output is correct
28 Correct 84 ms 31772 KB Output is correct
29 Correct 79 ms 31676 KB Output is correct
30 Correct 13 ms 31692 KB Output is correct
31 Correct 83 ms 31692 KB Output is correct
32 Correct 74 ms 31776 KB Output is correct
33 Correct 48 ms 31692 KB Output is correct
34 Correct 84 ms 31700 KB Output is correct
35 Correct 50 ms 31772 KB Output is correct
36 Correct 106 ms 31764 KB Output is correct
37 Correct 238 ms 31776 KB Output is correct
38 Correct 419 ms 31772 KB Output is correct
39 Correct 450 ms 31820 KB Output is correct
40 Correct 16 ms 31692 KB Output is correct
41 Correct 200 ms 31772 KB Output is correct
42 Correct 326 ms 31772 KB Output is correct
43 Incorrect 85 ms 31692 KB Output isn't correct
44 Halted 0 ms 0 KB -