답안 #478221

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

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

int64_t ans = INT_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;
}

Compilation message

sculpture.cpp: In function 'void dfs(int64_t, int64_t, int64_t, int64_t)':
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 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 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 216 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 4 ms 204 KB Output is correct
14 Incorrect 1 ms 204 KB Output isn't correct
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 1 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 0 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 Incorrect 0 ms 204 KB Output isn't correct
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 1 ms 204 KB Output is correct
4 Correct 1 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 4 ms 204 KB Output is correct
14 Correct 7 ms 292 KB Output is correct
15 Correct 19 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Execution timed out 1045 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 0 ms 204 KB Output is correct
5 Correct 1 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 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 4 ms 204 KB Output is correct
14 Incorrect 0 ms 204 KB Output isn't correct
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 0 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 244 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 1 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 0 ms 204 KB Output is correct
15 Correct 0 ms 208 KB Output is correct
16 Correct 0 ms 208 KB Output is correct
17 Incorrect 1 ms 300 KB Output isn't correct
18 Halted 0 ms 0 KB -