답안 #112134

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
112134 2019-05-17T14:52:19 Z Runtime_error_ Bali Sculptures (APIO15_sculpture) C++14
21 / 100
13 ms 3840 KB
#include <bits/stdc++.h>
using namespace std;
const int N=105,O=(1<<13)+9,MX=1e9+9;
int n,x,y,a[N],pre[N],dp[N][O];

int solve(int pos,int OR){

    if(pos==n+1)
        return 0;

    int &ret=dp[pos][OR];
    if(ret!=-1)
        return ret;
    ret=MX;
    for(int i=pos;i<=n;i++)
        if( (OR & (pre[i]-pre[pos-1])) ==0  )
            ret=min(ret,solve(i+1,OR)+1);
    return ret;
}

int reversed(int num){//we reverse all the bits up to the 12-th bit

    int ret=0;
    for(int i=0;i<=12;i++)
        if( (num&(1<<i))==0 )
            ret|=(1<<i);
    return ret;
}

int main(){

    cin>>n>>x>>y;
    for(int i=1;i<=n;i++)
        cin>>a[i],pre[i]=a[i]+pre[i-1];

    memset(dp,-1,sizeof(dp));
    
    for(int i=0;i<(1<<12);i++)
        if(solve(1,reversed(i))<=y)
            cout<<i<<endl,exit(0);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 3712 KB Output is correct
2 Correct 4 ms 3712 KB Output is correct
3 Correct 5 ms 3712 KB Output is correct
4 Correct 7 ms 3712 KB Output is correct
5 Correct 5 ms 3712 KB Output is correct
6 Correct 5 ms 3712 KB Output is correct
7 Correct 5 ms 3712 KB Output is correct
8 Correct 5 ms 3712 KB Output is correct
9 Correct 5 ms 3712 KB Output is correct
10 Correct 4 ms 3712 KB Output is correct
11 Correct 5 ms 3712 KB Output is correct
12 Correct 6 ms 3712 KB Output is correct
13 Correct 7 ms 3712 KB Output is correct
14 Correct 4 ms 3712 KB Output is correct
15 Incorrect 4 ms 3712 KB Output isn't correct
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 3712 KB Output is correct
2 Correct 4 ms 3684 KB Output is correct
3 Correct 4 ms 3712 KB Output is correct
4 Correct 5 ms 3712 KB Output is correct
5 Correct 4 ms 3712 KB Output is correct
6 Correct 5 ms 3712 KB Output is correct
7 Correct 4 ms 3712 KB Output is correct
8 Correct 6 ms 3712 KB Output is correct
9 Correct 4 ms 3712 KB Output is correct
10 Correct 0 ms 3712 KB Output is correct
11 Correct 4 ms 3712 KB Output is correct
12 Correct 5 ms 3712 KB Output is correct
13 Correct 5 ms 3712 KB Output is correct
14 Correct 4 ms 3712 KB Output is correct
15 Incorrect 4 ms 3712 KB Output isn't correct
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 3712 KB Output is correct
2 Correct 4 ms 3712 KB Output is correct
3 Correct 4 ms 3740 KB Output is correct
4 Correct 4 ms 3712 KB Output is correct
5 Correct 4 ms 3712 KB Output is correct
6 Correct 5 ms 3712 KB Output is correct
7 Correct 4 ms 3712 KB Output is correct
8 Correct 4 ms 3712 KB Output is correct
9 Correct 4 ms 3712 KB Output is correct
10 Correct 4 ms 3712 KB Output is correct
11 Correct 4 ms 3712 KB Output is correct
12 Correct 5 ms 3712 KB Output is correct
13 Correct 5 ms 3712 KB Output is correct
14 Correct 4 ms 3712 KB Output is correct
15 Correct 4 ms 3712 KB Output is correct
16 Correct 4 ms 3712 KB Output is correct
17 Correct 4 ms 3712 KB Output is correct
18 Correct 4 ms 3712 KB Output is correct
19 Correct 4 ms 3712 KB Output is correct
20 Correct 5 ms 3712 KB Output is correct
21 Correct 5 ms 3712 KB Output is correct
22 Correct 4 ms 3712 KB Output is correct
23 Correct 4 ms 3712 KB Output is correct
24 Correct 4 ms 3712 KB Output is correct
25 Correct 4 ms 3712 KB Output is correct
26 Correct 5 ms 3712 KB Output is correct
27 Correct 4 ms 3712 KB Output is correct
28 Correct 4 ms 3712 KB Output is correct
29 Correct 4 ms 3712 KB Output is correct
30 Correct 13 ms 3840 KB Output is correct
31 Correct 4 ms 3712 KB Output is correct
32 Correct 4 ms 3712 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 3712 KB Output is correct
2 Correct 4 ms 3736 KB Output is correct
3 Correct 4 ms 3712 KB Output is correct
4 Correct 4 ms 3712 KB Output is correct
5 Correct 4 ms 3584 KB Output is correct
6 Correct 4 ms 3712 KB Output is correct
7 Correct 4 ms 3712 KB Output is correct
8 Correct 4 ms 3840 KB Output is correct
9 Correct 4 ms 3712 KB Output is correct
10 Correct 4 ms 3712 KB Output is correct
11 Correct 4 ms 3712 KB Output is correct
12 Correct 4 ms 3712 KB Output is correct
13 Correct 4 ms 3712 KB Output is correct
14 Correct 4 ms 3712 KB Output is correct
15 Incorrect 4 ms 3684 KB Output isn't correct
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 3712 KB Output is correct
2 Correct 4 ms 3712 KB Output is correct
3 Correct 4 ms 3712 KB Output is correct
4 Correct 4 ms 3712 KB Output is correct
5 Correct 4 ms 3712 KB Output is correct
6 Correct 4 ms 3712 KB Output is correct
7 Correct 4 ms 3712 KB Output is correct
8 Correct 4 ms 3712 KB Output is correct
9 Correct 4 ms 3712 KB Output is correct
10 Correct 4 ms 3712 KB Output is correct
11 Correct 4 ms 3712 KB Output is correct
12 Correct 4 ms 3712 KB Output is correct
13 Correct 4 ms 3712 KB Output is correct
14 Incorrect 4 ms 3712 KB Output isn't correct
15 Halted 0 ms 0 KB -