답안 #954217

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
954217 2024-03-27T12:33:27 Z dwuy Bali Sculptures (APIO15_sculpture) C++17
100 / 100
986 ms 1208 KB
/**   - dwuy -

      />    フ
      |  _  _|
      /`ミ _x ノ
     /      |
    /   ヽ   ?
 / ̄|   | | |
 | ( ̄ヽ__ヽ_)_)
 \二つ

**/
#include <bits/stdc++.h>

#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL)
#define file(a) freopen(a".inp","r",stdin); freopen(a".out", "w",stdout)
#define fi first
#define se second
#define endl "\n"
#define len(s) int32_t(s.length())
#define MASK(k)(1LL<<(k))
#define TASK "test"
#define int long long

using namespace std;

typedef tuple<int, int, int> tpiii;
typedef pair<double, double> pdd;
typedef pair<int, int> pii;
typedef long long ll;

const long long OO = 1e18;
const int MOD = 1e9 + 7;
const int INF = 1e9;
const int MX = 2005;

int n, L, R;
int a[MX];

void nhap(){
    cin >> n >> L >> R;
    for(int i=1; i<=n; i++) cin >> a[i];
}

void solve(){
    int ans = 0;
    for(int mask=MASK(46); mask; mask>>=1){
        bitset<MX> f[MX] = {0};
        f[0][0] = 1;
        for(int i=1; i<=n; i++){
            int sum = 0;
            for(int j=i; j>=1; j--){
                sum += a[j];
                int tmp = sum&(-1LL^(mask-1));
                if((tmp|ans) == ans){
                    f[i] |= f[j-1]<<1;
                }
            }
        }
        bool ok = 0;
        for(int i=L; i<=R; i++) ok |= f[n][i];
        if(!ok) ans |= mask;
    }
    cout << ans;
}

int32_t main(){
    fastIO;
    //file(TASK);

    nhap();
    solve();

    return 0;
}




# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 860 KB Output is correct
2 Correct 1 ms 860 KB Output is correct
3 Correct 1 ms 860 KB Output is correct
4 Correct 1 ms 860 KB Output is correct
5 Correct 1 ms 860 KB Output is correct
6 Correct 1 ms 860 KB Output is correct
7 Correct 1 ms 860 KB Output is correct
8 Correct 1 ms 860 KB Output is correct
9 Correct 2 ms 860 KB Output is correct
10 Correct 1 ms 860 KB Output is correct
11 Correct 1 ms 720 KB Output is correct
12 Correct 2 ms 856 KB Output is correct
13 Correct 1 ms 860 KB Output is correct
14 Correct 1 ms 860 KB Output is correct
15 Correct 1 ms 860 KB Output is correct
16 Correct 1 ms 860 KB Output is correct
17 Correct 1 ms 860 KB Output is correct
18 Correct 1 ms 860 KB Output is correct
19 Correct 1 ms 860 KB Output is correct
20 Correct 1 ms 860 KB Output is correct
21 Correct 1 ms 716 KB Output is correct
22 Correct 1 ms 856 KB Output is correct
23 Correct 1 ms 860 KB Output is correct
24 Correct 1 ms 1112 KB Output is correct
25 Correct 1 ms 860 KB Output is correct
26 Correct 1 ms 860 KB Output is correct
27 Correct 1 ms 868 KB Output is correct
28 Correct 1 ms 716 KB Output is correct
29 Correct 1 ms 860 KB Output is correct
30 Correct 1 ms 860 KB Output is correct
31 Correct 1 ms 860 KB Output is correct
32 Correct 1 ms 860 KB Output is correct
33 Correct 1 ms 860 KB Output is correct
34 Correct 1 ms 860 KB Output is correct
35 Correct 1 ms 860 KB Output is correct
36 Correct 2 ms 856 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 860 KB Output is correct
2 Correct 1 ms 860 KB Output is correct
3 Correct 1 ms 860 KB Output is correct
4 Correct 1 ms 860 KB Output is correct
5 Correct 1 ms 860 KB Output is correct
6 Correct 1 ms 860 KB Output is correct
7 Correct 2 ms 860 KB Output is correct
8 Correct 1 ms 860 KB Output is correct
9 Correct 2 ms 960 KB Output is correct
10 Correct 2 ms 860 KB Output is correct
11 Correct 1 ms 860 KB Output is correct
12 Correct 1 ms 856 KB Output is correct
13 Correct 1 ms 860 KB Output is correct
14 Correct 2 ms 860 KB Output is correct
15 Correct 1 ms 860 KB Output is correct
16 Correct 1 ms 860 KB Output is correct
17 Correct 1 ms 1112 KB Output is correct
18 Correct 1 ms 860 KB Output is correct
19 Correct 1 ms 860 KB Output is correct
20 Correct 1 ms 860 KB Output is correct
21 Correct 2 ms 860 KB Output is correct
22 Correct 1 ms 860 KB Output is correct
23 Correct 1 ms 860 KB Output is correct
24 Correct 1 ms 856 KB Output is correct
25 Correct 2 ms 1112 KB Output is correct
26 Correct 1 ms 860 KB Output is correct
27 Correct 2 ms 860 KB Output is correct
28 Correct 2 ms 860 KB Output is correct
29 Correct 3 ms 856 KB Output is correct
30 Correct 3 ms 860 KB Output is correct
31 Correct 3 ms 860 KB Output is correct
32 Correct 4 ms 856 KB Output is correct
33 Correct 4 ms 960 KB Output is correct
34 Correct 3 ms 1112 KB Output is correct
35 Correct 4 ms 860 KB Output is correct
36 Correct 3 ms 1112 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 860 KB Output is correct
2 Correct 1 ms 860 KB Output is correct
3 Correct 1 ms 860 KB Output is correct
4 Correct 1 ms 860 KB Output is correct
5 Correct 1 ms 860 KB Output is correct
6 Correct 1 ms 812 KB Output is correct
7 Correct 2 ms 856 KB Output is correct
8 Correct 1 ms 860 KB Output is correct
9 Correct 1 ms 860 KB Output is correct
10 Correct 1 ms 860 KB Output is correct
11 Correct 1 ms 860 KB Output is correct
12 Correct 2 ms 860 KB Output is correct
13 Correct 1 ms 956 KB Output is correct
14 Correct 1 ms 856 KB Output is correct
15 Correct 2 ms 856 KB Output is correct
16 Correct 3 ms 856 KB Output is correct
17 Correct 3 ms 860 KB Output is correct
18 Correct 3 ms 860 KB Output is correct
19 Correct 4 ms 860 KB Output is correct
20 Correct 3 ms 860 KB Output is correct
21 Correct 4 ms 860 KB Output is correct
22 Correct 4 ms 860 KB Output is correct
23 Correct 4 ms 856 KB Output is correct
24 Correct 3 ms 860 KB Output is correct
25 Correct 5 ms 860 KB Output is correct
26 Correct 7 ms 860 KB Output is correct
27 Correct 9 ms 960 KB Output is correct
28 Correct 10 ms 860 KB Output is correct
29 Correct 10 ms 956 KB Output is correct
30 Correct 11 ms 860 KB Output is correct
31 Correct 10 ms 960 KB Output is correct
32 Correct 11 ms 1112 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 856 KB Output is correct
2 Correct 1 ms 860 KB Output is correct
3 Correct 1 ms 860 KB Output is correct
4 Correct 1 ms 856 KB Output is correct
5 Correct 2 ms 860 KB Output is correct
6 Correct 1 ms 860 KB Output is correct
7 Correct 1 ms 860 KB Output is correct
8 Correct 1 ms 860 KB Output is correct
9 Correct 2 ms 860 KB Output is correct
10 Correct 1 ms 860 KB Output is correct
11 Correct 1 ms 860 KB Output is correct
12 Correct 1 ms 860 KB Output is correct
13 Correct 1 ms 860 KB Output is correct
14 Correct 1 ms 856 KB Output is correct
15 Correct 1 ms 856 KB Output is correct
16 Correct 1 ms 860 KB Output is correct
17 Correct 1 ms 860 KB Output is correct
18 Correct 1 ms 860 KB Output is correct
19 Correct 1 ms 924 KB Output is correct
20 Correct 1 ms 860 KB Output is correct
21 Correct 1 ms 860 KB Output is correct
22 Correct 2 ms 856 KB Output is correct
23 Correct 1 ms 856 KB Output is correct
24 Correct 1 ms 860 KB Output is correct
25 Correct 2 ms 860 KB Output is correct
26 Correct 1 ms 860 KB Output is correct
27 Correct 1 ms 860 KB Output is correct
28 Correct 1 ms 716 KB Output is correct
29 Correct 1 ms 860 KB Output is correct
30 Correct 1 ms 860 KB Output is correct
31 Correct 1 ms 860 KB Output is correct
32 Correct 1 ms 856 KB Output is correct
33 Correct 1 ms 860 KB Output is correct
34 Correct 1 ms 860 KB Output is correct
35 Correct 1 ms 860 KB Output is correct
36 Correct 1 ms 860 KB Output is correct
37 Correct 1 ms 860 KB Output is correct
38 Correct 2 ms 860 KB Output is correct
39 Correct 3 ms 856 KB Output is correct
40 Correct 3 ms 856 KB Output is correct
41 Correct 3 ms 856 KB Output is correct
42 Correct 3 ms 860 KB Output is correct
43 Correct 4 ms 856 KB Output is correct
44 Correct 4 ms 860 KB Output is correct
45 Correct 3 ms 860 KB Output is correct
46 Correct 3 ms 860 KB Output is correct
47 Correct 3 ms 860 KB Output is correct
48 Correct 5 ms 860 KB Output is correct
49 Correct 7 ms 956 KB Output is correct
50 Correct 10 ms 860 KB Output is correct
51 Correct 10 ms 856 KB Output is correct
52 Correct 12 ms 860 KB Output is correct
53 Correct 11 ms 860 KB Output is correct
54 Correct 11 ms 860 KB Output is correct
55 Correct 11 ms 860 KB Output is correct
56 Correct 2 ms 1112 KB Output is correct
57 Correct 3 ms 860 KB Output is correct
58 Correct 4 ms 1112 KB Output is correct
59 Correct 6 ms 860 KB Output is correct
60 Correct 4 ms 1112 KB Output is correct
61 Correct 4 ms 860 KB Output is correct
62 Correct 5 ms 860 KB Output is correct
63 Correct 5 ms 856 KB Output is correct
64 Correct 9 ms 860 KB Output is correct
65 Correct 2 ms 1112 KB Output is correct
66 Correct 3 ms 860 KB Output is correct
67 Correct 3 ms 860 KB Output is correct
68 Correct 4 ms 856 KB Output is correct
69 Correct 4 ms 996 KB Output is correct
70 Correct 4 ms 860 KB Output is correct
71 Correct 4 ms 860 KB Output is correct
72 Correct 5 ms 860 KB Output is correct
73 Correct 5 ms 860 KB Output is correct
74 Correct 5 ms 856 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 860 KB Output is correct
2 Correct 1 ms 860 KB Output is correct
3 Correct 1 ms 856 KB Output is correct
4 Correct 1 ms 860 KB Output is correct
5 Correct 1 ms 860 KB Output is correct
6 Correct 1 ms 860 KB Output is correct
7 Correct 1 ms 860 KB Output is correct
8 Correct 1 ms 860 KB Output is correct
9 Correct 2 ms 860 KB Output is correct
10 Correct 1 ms 860 KB Output is correct
11 Correct 1 ms 860 KB Output is correct
12 Correct 1 ms 956 KB Output is correct
13 Correct 1 ms 860 KB Output is correct
14 Correct 1 ms 860 KB Output is correct
15 Correct 1 ms 860 KB Output is correct
16 Correct 1 ms 860 KB Output is correct
17 Correct 1 ms 860 KB Output is correct
18 Correct 1 ms 860 KB Output is correct
19 Correct 1 ms 860 KB Output is correct
20 Correct 1 ms 860 KB Output is correct
21 Correct 2 ms 860 KB Output is correct
22 Correct 1 ms 860 KB Output is correct
23 Correct 1 ms 860 KB Output is correct
24 Correct 1 ms 860 KB Output is correct
25 Correct 1 ms 860 KB Output is correct
26 Correct 2 ms 860 KB Output is correct
27 Correct 3 ms 860 KB Output is correct
28 Correct 4 ms 860 KB Output is correct
29 Correct 4 ms 860 KB Output is correct
30 Correct 4 ms 860 KB Output is correct
31 Correct 4 ms 860 KB Output is correct
32 Correct 3 ms 860 KB Output is correct
33 Correct 3 ms 856 KB Output is correct
34 Correct 3 ms 860 KB Output is correct
35 Correct 5 ms 952 KB Output is correct
36 Correct 7 ms 860 KB Output is correct
37 Correct 9 ms 960 KB Output is correct
38 Correct 10 ms 860 KB Output is correct
39 Correct 10 ms 960 KB Output is correct
40 Correct 11 ms 860 KB Output is correct
41 Correct 11 ms 860 KB Output is correct
42 Correct 10 ms 1208 KB Output is correct
43 Correct 2 ms 860 KB Output is correct
44 Correct 3 ms 860 KB Output is correct
45 Correct 4 ms 856 KB Output is correct
46 Correct 5 ms 860 KB Output is correct
47 Correct 4 ms 860 KB Output is correct
48 Correct 4 ms 856 KB Output is correct
49 Correct 6 ms 860 KB Output is correct
50 Correct 5 ms 964 KB Output is correct
51 Correct 4 ms 856 KB Output is correct
52 Correct 94 ms 1112 KB Output is correct
53 Correct 149 ms 860 KB Output is correct
54 Correct 276 ms 956 KB Output is correct
55 Correct 256 ms 860 KB Output is correct
56 Correct 954 ms 960 KB Output is correct
57 Correct 893 ms 964 KB Output is correct
58 Correct 842 ms 964 KB Output is correct
59 Correct 806 ms 1104 KB Output is correct
60 Correct 986 ms 1112 KB Output is correct
61 Correct 6 ms 860 KB Output is correct
62 Correct 155 ms 940 KB Output is correct
63 Correct 257 ms 952 KB Output is correct
64 Correct 244 ms 956 KB Output is correct
65 Correct 455 ms 968 KB Output is correct
66 Correct 675 ms 860 KB Output is correct
67 Correct 911 ms 968 KB Output is correct
68 Correct 889 ms 964 KB Output is correct
69 Correct 855 ms 1108 KB Output is correct