답안 #482666

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
482666 2021-10-26T02:56:33 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;
 
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 : linf;
    if (rem == 0) return linf;
 
    ll& ret = dp[i][rem];
    if (ret != -1) return ret;
 
    ret = linf;
 
    For (j, i, n) {
        chmin(ret, go(j + 1, rem - 1) | (pref[j] - pref[i - 1]));
    }
 
    return ret;
}
 
signed main() {
    cin >> n >> lo >> hi;
    For (i, 1, n) cin >> a[i];
 
    For (i, 1, n) {
        pref[i] = pref[i - 1] + a[i];
    }
 
    ll ans = linf;
 
    For (i, lo, hi) {
        memset(dp, -1, sizeof(dp));
        chmin(ans, go(1, i));
    }
 
    cout << ans << '\n';
}
# 결과 실행 시간 메모리 Grader output
1 Correct 20 ms 31776 KB Output is correct
2 Correct 23 ms 31788 KB Output is correct
3 Correct 13 ms 31692 KB Output is correct
4 Correct 26 ms 31784 KB Output is correct
5 Correct 18 ms 31736 KB Output is correct
6 Correct 67 ms 31692 KB Output is correct
7 Correct 19 ms 31792 KB Output is correct
8 Correct 19 ms 31692 KB Output is correct
9 Correct 20 ms 31796 KB Output is correct
10 Correct 19 ms 31748 KB Output is correct
11 Correct 13 ms 31744 KB Output is correct
12 Correct 20 ms 31784 KB Output is correct
13 Correct 69 ms 31772 KB Output is correct
14 Correct 17 ms 31668 KB Output is correct
15 Correct 15 ms 31756 KB Output is correct
16 Correct 24 ms 31752 KB Output is correct
17 Correct 17 ms 31692 KB Output is correct
18 Correct 20 ms 31768 KB Output is correct
19 Correct 12 ms 31700 KB Output is correct
20 Correct 12 ms 31692 KB Output is correct
21 Incorrect 23 ms 31788 KB Output isn't correct
22 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 20 ms 31796 KB Output is correct
2 Correct 23 ms 31692 KB Output is correct
3 Correct 12 ms 31704 KB Output is correct
4 Correct 23 ms 31788 KB Output is correct
5 Correct 16 ms 31728 KB Output is correct
6 Correct 69 ms 31708 KB Output is correct
7 Correct 25 ms 31692 KB Output is correct
8 Correct 21 ms 31792 KB Output is correct
9 Correct 20 ms 31740 KB Output is correct
10 Correct 20 ms 31688 KB Output is correct
11 Correct 13 ms 31744 KB Output is correct
12 Correct 20 ms 31732 KB Output is correct
13 Correct 70 ms 31692 KB Output is correct
14 Correct 17 ms 31756 KB Output is correct
15 Correct 14 ms 31756 KB Output is correct
16 Correct 25 ms 31692 KB Output is correct
17 Correct 16 ms 31748 KB Output is correct
18 Correct 20 ms 31740 KB Output is correct
19 Correct 14 ms 31692 KB Output is correct
20 Correct 14 ms 31692 KB Output is correct
21 Incorrect 23 ms 31720 KB Output isn't correct
22 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 21 ms 31692 KB Output is correct
2 Correct 23 ms 31760 KB Output is correct
3 Correct 13 ms 31776 KB Output is correct
4 Correct 20 ms 31788 KB Output is correct
5 Correct 14 ms 31692 KB Output is correct
6 Correct 67 ms 31700 KB Output is correct
7 Correct 19 ms 31692 KB Output is correct
8 Correct 22 ms 31692 KB Output is correct
9 Correct 20 ms 31692 KB Output is correct
10 Correct 19 ms 31720 KB Output is correct
11 Correct 12 ms 31776 KB Output is correct
12 Correct 23 ms 31820 KB Output is correct
13 Correct 72 ms 31776 KB Output is correct
14 Correct 89 ms 31772 KB Output is correct
15 Correct 47 ms 31692 KB Output is correct
16 Correct 27 ms 31692 KB Output is correct
17 Correct 74 ms 31776 KB Output is correct
18 Correct 84 ms 31772 KB Output is correct
19 Correct 95 ms 31692 KB Output is correct
20 Correct 13 ms 31692 KB Output is correct
21 Correct 83 ms 31772 KB Output is correct
22 Correct 68 ms 31772 KB Output is correct
23 Correct 51 ms 31692 KB Output is correct
24 Correct 84 ms 31692 KB Output is correct
25 Correct 45 ms 31784 KB Output is correct
26 Correct 96 ms 31772 KB Output is correct
27 Correct 236 ms 31700 KB Output is correct
28 Correct 450 ms 31772 KB Output is correct
29 Correct 448 ms 31692 KB Output is correct
30 Correct 14 ms 31792 KB Output is correct
31 Correct 209 ms 31692 KB Output is correct
32 Correct 342 ms 31776 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 20 ms 31692 KB Output is correct
2 Correct 24 ms 31692 KB Output is correct
3 Correct 13 ms 31676 KB Output is correct
4 Correct 21 ms 31788 KB Output is correct
5 Correct 14 ms 31676 KB Output is correct
6 Correct 65 ms 31756 KB Output is correct
7 Correct 20 ms 31732 KB Output is correct
8 Correct 22 ms 31796 KB Output is correct
9 Correct 22 ms 31692 KB Output is correct
10 Correct 21 ms 31692 KB Output is correct
11 Correct 16 ms 31720 KB Output is correct
12 Correct 22 ms 31792 KB Output is correct
13 Correct 79 ms 31760 KB Output is correct
14 Correct 17 ms 31736 KB Output is correct
15 Correct 14 ms 31692 KB Output is correct
16 Correct 24 ms 31696 KB Output is correct
17 Correct 16 ms 31692 KB Output is correct
18 Correct 20 ms 31708 KB Output is correct
19 Correct 13 ms 31688 KB Output is correct
20 Correct 13 ms 31760 KB Output is correct
21 Incorrect 25 ms 31700 KB Output isn't correct
22 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 21 ms 31820 KB Output is correct
2 Correct 31 ms 31692 KB Output is correct
3 Correct 18 ms 31728 KB Output is correct
4 Correct 22 ms 31688 KB Output is correct
5 Correct 18 ms 31788 KB Output is correct
6 Correct 63 ms 31712 KB Output is correct
7 Correct 21 ms 31692 KB Output is correct
8 Correct 21 ms 31788 KB Output is correct
9 Correct 21 ms 31672 KB Output is correct
10 Correct 23 ms 31740 KB Output is correct
11 Correct 17 ms 31688 KB Output is correct
12 Correct 25 ms 31676 KB Output is correct
13 Correct 73 ms 31788 KB Output is correct
14 Correct 21 ms 31692 KB Output is correct
15 Correct 24 ms 31784 KB Output is correct
16 Correct 56 ms 31784 KB Output is correct
17 Correct 20 ms 31692 KB Output is correct
18 Correct 36 ms 31692 KB Output is correct
19 Correct 14 ms 31708 KB Output is correct
20 Correct 65 ms 31692 KB Output is correct
21 Correct 83 ms 31784 KB Output is correct
22 Correct 21 ms 31768 KB Output is correct
23 Correct 84 ms 31772 KB Output is correct
24 Correct 83 ms 31692 KB Output is correct
25 Correct 47 ms 31784 KB Output is correct
26 Correct 27 ms 31692 KB Output is correct
27 Correct 74 ms 31692 KB Output is correct
28 Correct 81 ms 31784 KB Output is correct
29 Correct 84 ms 31784 KB Output is correct
30 Correct 16 ms 31780 KB Output is correct
31 Correct 91 ms 31772 KB Output is correct
32 Correct 73 ms 31688 KB Output is correct
33 Correct 44 ms 31692 KB Output is correct
34 Correct 80 ms 31792 KB Output is correct
35 Correct 48 ms 31692 KB Output is correct
36 Correct 99 ms 31692 KB Output is correct
37 Correct 221 ms 31780 KB Output is correct
38 Correct 442 ms 31780 KB Output is correct
39 Correct 425 ms 31776 KB Output is correct
40 Correct 14 ms 31684 KB Output is correct
41 Correct 216 ms 31772 KB Output is correct
42 Correct 318 ms 31772 KB Output is correct
43 Incorrect 84 ms 31692 KB Output isn't correct
44 Halted 0 ms 0 KB -