답안 #478220

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

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

int ans = INT_MAX;

void dfs(int i, int cnt, int curr, int 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;
}

Compilation message

sculpture.cpp: In function 'void dfs(int, int, int, int)':
sculpture.cpp:12:9: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   12 |         if(cnt >= a && cnt <= b)
      |         ^~
sculpture.cpp:14:13: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   14 |             ans=min(ans,curr);
      |             ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 0 ms 208 KB Output is correct
6 Correct 1 ms 208 KB Output is correct
7 Correct 0 ms 300 KB Output is correct
8 Correct 0 ms 208 KB Output is correct
9 Correct 0 ms 208 KB Output is correct
10 Correct 0 ms 208 KB Output is correct
11 Correct 0 ms 208 KB Output is correct
12 Correct 0 ms 208 KB Output is correct
13 Correct 4 ms 208 KB Output is correct
14 Incorrect 1 ms 208 KB Output isn't correct
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 1 ms 300 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 1 ms 208 KB Output is correct
6 Correct 1 ms 208 KB Output is correct
7 Correct 0 ms 208 KB Output is correct
8 Correct 0 ms 208 KB Output is correct
9 Correct 0 ms 208 KB Output is correct
10 Correct 0 ms 208 KB Output is correct
11 Correct 0 ms 208 KB Output is correct
12 Correct 0 ms 208 KB Output is correct
13 Correct 4 ms 300 KB Output is correct
14 Incorrect 1 ms 208 KB Output isn't correct
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 0 ms 208 KB Output is correct
5 Correct 0 ms 208 KB Output is correct
6 Correct 1 ms 208 KB Output is correct
7 Correct 1 ms 208 KB Output is correct
8 Correct 1 ms 292 KB Output is correct
9 Correct 1 ms 208 KB Output is correct
10 Correct 1 ms 208 KB Output is correct
11 Correct 0 ms 208 KB Output is correct
12 Correct 1 ms 208 KB Output is correct
13 Correct 6 ms 208 KB Output is correct
14 Correct 8 ms 292 KB Output is correct
15 Correct 20 ms 292 KB Output is correct
16 Correct 2 ms 208 KB Output is correct
17 Execution timed out 1081 ms 208 KB Time limit exceeded
18 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Correct 0 ms 208 KB Output is correct
5 Correct 1 ms 208 KB Output is correct
6 Correct 1 ms 208 KB Output is correct
7 Correct 0 ms 208 KB Output is correct
8 Correct 0 ms 296 KB Output is correct
9 Correct 0 ms 208 KB Output is correct
10 Correct 0 ms 208 KB Output is correct
11 Correct 1 ms 208 KB Output is correct
12 Correct 1 ms 208 KB Output is correct
13 Correct 4 ms 208 KB Output is correct
14 Incorrect 0 ms 208 KB Output isn't correct
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 1 ms 208 KB Output is correct
6 Correct 1 ms 208 KB Output is correct
7 Correct 0 ms 208 KB Output is correct
8 Correct 1 ms 208 KB Output is correct
9 Correct 1 ms 208 KB Output is correct
10 Correct 1 ms 208 KB Output is correct
11 Correct 1 ms 208 KB Output is correct
12 Correct 0 ms 208 KB Output is correct
13 Correct 4 ms 208 KB Output is correct
14 Incorrect 0 ms 208 KB Output isn't correct
15 Halted 0 ms 0 KB -