답안 #478236

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
478236 2021-10-06T16:03:56 Z PiejanVDC Bali Sculptures (APIO15_sculpture) C++17
9 / 100
1000 ms 392 KB
#include <bits/stdc++.h>
using namespace std;

int64_t n,a,b;
vector<int64_t>v;
vector<int64_t>pref;

int64_t ans = LLONG_MAX;

void dfs(int64_t i, int64_t cnt, int64_t curr, int64_t prev) {
    if(i == n) {
        if(cnt >= a && cnt <= b)
            curr|=(pref[i]-pref[prev]),ans=min(ans,curr);
        return;
    }
    if(cnt < b) {
        if(i != 0)
            dfs(i+1,cnt+1,(curr|(pref[i]-pref[prev])),i);
    }
    dfs(i+1,cnt,curr,prev);
}

signed main() {
    cin>>n>>a>>b;
    v.resize(n);
    for(auto &z : v)
        cin>>z;
    pref.resize(n+1);
    pref[0]=0;
    for(int i = 0 ; i < n ; i++)
        pref[i+1] = pref[i] + v[i];
    dfs(0,1,0,0);
    cout << ans;
}
# 결과 실행 시간 메모리 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 0 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 4 ms 204 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Correct 1 ms 208 KB Output is correct
16 Correct 0 ms 208 KB Output is correct
17 Correct 1 ms 208 KB Output is correct
18 Correct 0 ms 208 KB Output is correct
19 Correct 1 ms 208 KB Output is correct
20 Correct 0 ms 208 KB Output is correct
21 Correct 1 ms 208 KB Output is correct
22 Correct 1 ms 208 KB Output is correct
23 Correct 1 ms 208 KB Output is correct
24 Correct 1 ms 208 KB Output is correct
25 Correct 1 ms 208 KB Output is correct
26 Correct 4 ms 296 KB Output is correct
27 Correct 0 ms 208 KB Output is correct
28 Correct 0 ms 208 KB Output is correct
29 Correct 1 ms 208 KB Output is correct
30 Correct 1 ms 208 KB Output is correct
31 Correct 1 ms 208 KB Output is correct
32 Correct 0 ms 208 KB Output is correct
33 Correct 4 ms 208 KB Output is correct
34 Correct 4 ms 208 KB Output is correct
35 Correct 1 ms 268 KB Output is correct
36 Correct 4 ms 208 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 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 0 ms 204 KB Output is correct
13 Correct 4 ms 288 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Correct 1 ms 208 KB Output is correct
16 Correct 0 ms 208 KB Output is correct
17 Correct 0 ms 208 KB Output is correct
18 Correct 0 ms 208 KB Output is correct
19 Correct 1 ms 208 KB Output is correct
20 Correct 1 ms 208 KB Output is correct
21 Correct 1 ms 300 KB Output is correct
22 Correct 1 ms 208 KB Output is correct
23 Correct 1 ms 208 KB Output is correct
24 Correct 0 ms 208 KB Output is correct
25 Correct 1 ms 208 KB Output is correct
26 Correct 4 ms 208 KB Output is correct
27 Correct 7 ms 208 KB Output is correct
28 Correct 19 ms 296 KB Output is correct
29 Correct 2 ms 208 KB Output is correct
30 Execution timed out 1097 ms 208 KB Time limit exceeded
31 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 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 0 ms 204 KB Output is correct
13 Correct 4 ms 204 KB Output is correct
14 Correct 8 ms 284 KB Output is correct
15 Correct 20 ms 204 KB Output is correct
16 Correct 2 ms 204 KB Output is correct
17 Execution timed out 1088 ms 204 KB Time limit exceeded
18 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 1 ms 224 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 0 ms 204 KB Output is correct
13 Correct 4 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 0 ms 208 KB Output is correct
16 Correct 1 ms 208 KB Output is correct
17 Correct 1 ms 208 KB Output is correct
18 Correct 1 ms 208 KB Output is correct
19 Correct 1 ms 208 KB Output is correct
20 Correct 0 ms 208 KB Output is correct
21 Correct 1 ms 300 KB Output is correct
22 Correct 1 ms 208 KB Output is correct
23 Correct 1 ms 208 KB Output is correct
24 Correct 0 ms 208 KB Output is correct
25 Correct 1 ms 208 KB Output is correct
26 Correct 4 ms 208 KB Output is correct
27 Correct 1 ms 208 KB Output is correct
28 Correct 0 ms 208 KB Output is correct
29 Correct 0 ms 208 KB Output is correct
30 Correct 1 ms 392 KB Output is correct
31 Correct 1 ms 208 KB Output is correct
32 Correct 1 ms 296 KB Output is correct
33 Correct 4 ms 300 KB Output is correct
34 Correct 4 ms 272 KB Output is correct
35 Correct 1 ms 300 KB Output is correct
36 Correct 4 ms 208 KB Output is correct
37 Correct 7 ms 208 KB Output is correct
38 Correct 19 ms 208 KB Output is correct
39 Correct 1 ms 208 KB Output is correct
40 Execution timed out 1093 ms 208 KB Time limit exceeded
41 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 0 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 0 ms 204 KB Output is correct
13 Correct 6 ms 204 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Correct 0 ms 204 KB Output is correct
16 Correct 0 ms 204 KB Output is correct
17 Correct 0 ms 204 KB Output is correct
18 Correct 1 ms 292 KB Output is correct
19 Correct 0 ms 204 KB Output is correct
20 Correct 4 ms 204 KB Output is correct
21 Correct 4 ms 204 KB Output is correct
22 Correct 0 ms 204 KB Output is correct
23 Correct 4 ms 204 KB Output is correct
24 Correct 8 ms 204 KB Output is correct
25 Correct 19 ms 204 KB Output is correct
26 Correct 1 ms 204 KB Output is correct
27 Execution timed out 1099 ms 204 KB Time limit exceeded
28 Halted 0 ms 0 KB -