답안 #490572

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
490572 2021-11-28T03:31:06 Z DeadlyCritic Bali Sculptures (APIO15_sculpture) C++17
50 / 100
953 ms 964 KB
#include <bits/stdc++.h>
// #pragma GCC optimize ("O2,unroll-loops")
// #pragma GCC optimize("no-stack-protector,fast-math")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define IOS ios::sync_with_stdio(0), cin.tie(), cout.tie();

#define fr first
#define sc second
#define all(v) v.begin(), v.end()
#define uni(v) sort(all(v)), v.erase(unique(all(v)), v.end())

// #define c0 (v << 1)
// #define c1 (c0 | 1)
// #define md ((l+r)>>1)

using namespace std;

typedef long long ll;

const int maxN = 2e3+7;
const int maxBt = 42;

ll pef[maxN];
int y[maxN];
bitset<maxN> dp[maxN];

inline ll range(int l, int r){
    return pef[r+1]-pef[l];
}

signed main(){IOS

    int n;
    int a, b;
    cin >> n >> a >> b;
    for(int i = 0; i < n; i++){
        cin >> y[i];
    }

    assert(n < maxN);
    assert(a == 1);

    ll ans = 0;
    ll bads = 0;

    pef[0] = 0;
    for(int i = 0; i < n; i++)pef[i+1] = pef[i]+y[i];

    ll maxAns = 1ll << (maxBt+1);

    for(int bit = maxBt; bit >= 0; bit--){
        bads += (1ll << bit);

        for(int i = 0; i <= n; i++)for(int j = 0; j <= n; j++)dp[i][j] = 0;
        for(int i = a; i <= b; i++)dp[0][i] = 1;

        for(int i = 0; i < n; i++){
            for(int j = 0; j <= i; j++){
                if(range(j, i) >= maxAns)break;
                if((range(j, i) & bads) == 0){
                    dp[i+1] |= dp[j] >> 1;
                }
            }
        }

        if(dp[n][0] == 0){
            bads ^= (1ll << bit);
            ans ^= (1ll << bit);
        }
    }

    cout << ans << '\n';
    

}

/*
6 1 3
8 1 2 1 5 4
*/
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Correct 0 ms 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 2 ms 204 KB Output is correct
14 Runtime error 1 ms 460 KB Execution killed with signal 6
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 332 KB Output is correct
4 Correct 0 ms 332 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 332 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
14 Runtime error 1 ms 460 KB Execution killed with signal 6
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 1 ms 332 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Correct 1 ms 332 KB Output is correct
16 Correct 2 ms 332 KB Output is correct
17 Correct 2 ms 332 KB Output is correct
18 Correct 3 ms 332 KB Output is correct
19 Correct 3 ms 332 KB Output is correct
20 Correct 3 ms 332 KB Output is correct
21 Correct 3 ms 332 KB Output is correct
22 Correct 3 ms 332 KB Output is correct
23 Correct 3 ms 332 KB Output is correct
24 Correct 3 ms 332 KB Output is correct
25 Correct 5 ms 436 KB Output is correct
26 Correct 6 ms 348 KB Output is correct
27 Correct 9 ms 332 KB Output is correct
28 Correct 10 ms 332 KB Output is correct
29 Correct 10 ms 348 KB Output is correct
30 Correct 11 ms 332 KB Output is correct
31 Correct 10 ms 332 KB Output is correct
32 Correct 10 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 332 KB Output is correct
5 Correct 0 ms 332 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 1 ms 332 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 332 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
14 Runtime error 1 ms 460 KB Execution killed with signal 6
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 1 ms 332 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Correct 1 ms 332 KB Output is correct
16 Correct 1 ms 332 KB Output is correct
17 Correct 1 ms 332 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 1 ms 332 KB Output is correct
20 Correct 1 ms 332 KB Output is correct
21 Correct 1 ms 332 KB Output is correct
22 Correct 1 ms 204 KB Output is correct
23 Correct 1 ms 344 KB Output is correct
24 Correct 1 ms 344 KB Output is correct
25 Correct 1 ms 216 KB Output is correct
26 Correct 2 ms 344 KB Output is correct
27 Correct 4 ms 344 KB Output is correct
28 Correct 3 ms 344 KB Output is correct
29 Correct 3 ms 344 KB Output is correct
30 Correct 3 ms 344 KB Output is correct
31 Correct 3 ms 344 KB Output is correct
32 Correct 5 ms 344 KB Output is correct
33 Correct 4 ms 348 KB Output is correct
34 Correct 3 ms 352 KB Output is correct
35 Correct 5 ms 352 KB Output is correct
36 Correct 7 ms 344 KB Output is correct
37 Correct 9 ms 344 KB Output is correct
38 Correct 11 ms 344 KB Output is correct
39 Correct 10 ms 344 KB Output is correct
40 Correct 11 ms 344 KB Output is correct
41 Correct 13 ms 344 KB Output is correct
42 Correct 11 ms 344 KB Output is correct
43 Correct 2 ms 344 KB Output is correct
44 Correct 3 ms 344 KB Output is correct
45 Correct 5 ms 344 KB Output is correct
46 Correct 4 ms 332 KB Output is correct
47 Correct 3 ms 332 KB Output is correct
48 Correct 4 ms 332 KB Output is correct
49 Correct 5 ms 332 KB Output is correct
50 Correct 5 ms 332 KB Output is correct
51 Correct 4 ms 332 KB Output is correct
52 Correct 89 ms 460 KB Output is correct
53 Correct 149 ms 520 KB Output is correct
54 Correct 278 ms 596 KB Output is correct
55 Correct 239 ms 588 KB Output is correct
56 Correct 869 ms 840 KB Output is correct
57 Correct 853 ms 844 KB Output is correct
58 Correct 760 ms 840 KB Output is correct
59 Correct 757 ms 848 KB Output is correct
60 Correct 953 ms 848 KB Output is correct
61 Correct 5 ms 332 KB Output is correct
62 Correct 146 ms 520 KB Output is correct
63 Correct 266 ms 588 KB Output is correct
64 Correct 246 ms 588 KB Output is correct
65 Correct 422 ms 692 KB Output is correct
66 Correct 630 ms 784 KB Output is correct
67 Correct 832 ms 964 KB Output is correct
68 Correct 853 ms 844 KB Output is correct
69 Correct 816 ms 844 KB Output is correct