답안 #119117

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
119117 2019-06-20T11:47:13 Z Charis02 Bali Sculptures (APIO15_sculpture) C++14
21 / 100
11 ms 9344 KB
#include<iostream>
#include<stdio.h>
#include<vector>
#include<cmath>
#include<queue>
#include<string.h>
#include<map>
#include<set>
#include<algorithm>
#define ll long long
#define pi pair < ll,ll >
#define mp(a,b) make_pair(a,b)
#define rep(i,a,b) for(int i = a;i < b;i++)
#define N 104
#define INF 1e9+7

using namespace std;

ll n,a,b,ar[N];
ll dp[N][N][N];
ll psum[N];

ll get_sum(ll i,ll j)
{
    if(i == 0)
        return psum[j];
    return psum[j]-psum[i-1];
}

ll solve(ll cur,ll start,ll g)
{
    if(g > b)
        return INF;
    if(cur == n)
    {
        if(g < a)
            return INF;

        return get_sum(start,n-1);
    }

    if(dp[cur][start][g] != -1)
        return dp[cur][start][g];

    return dp[cur][start][g] = min(solve(cur+1,start,g),get_sum(start,cur)|solve(cur+1,cur+1,g+1));
}

int main()
{
    ios_base::sync_with_stdio(false);

    cin >> n >> a >> b;

    memset(dp,-1,sizeof dp);

    rep(i,0,n)
    {
        cin >> ar[i];

        if(i == 0)
            psum[i] = ar[i];
        else
            psum[i] = ar[i]+psum[i-1];
    }

    cout << solve(0,0,1);
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 9188 KB Output is correct
2 Correct 8 ms 9216 KB Output is correct
3 Correct 8 ms 9216 KB Output is correct
4 Correct 8 ms 9216 KB Output is correct
5 Correct 8 ms 9216 KB Output is correct
6 Correct 8 ms 9088 KB Output is correct
7 Correct 9 ms 9216 KB Output is correct
8 Correct 8 ms 9216 KB Output is correct
9 Correct 9 ms 9216 KB Output is correct
10 Correct 9 ms 9216 KB Output is correct
11 Correct 9 ms 9088 KB Output is correct
12 Correct 9 ms 9088 KB Output is correct
13 Correct 9 ms 9216 KB Output is correct
14 Correct 9 ms 9088 KB Output is correct
15 Incorrect 9 ms 9088 KB Output isn't correct
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 9216 KB Output is correct
2 Correct 9 ms 9216 KB Output is correct
3 Correct 8 ms 9216 KB Output is correct
4 Correct 8 ms 9088 KB Output is correct
5 Correct 8 ms 9088 KB Output is correct
6 Correct 9 ms 9088 KB Output is correct
7 Correct 9 ms 9088 KB Output is correct
8 Correct 9 ms 9216 KB Output is correct
9 Correct 9 ms 9216 KB Output is correct
10 Correct 9 ms 9260 KB Output is correct
11 Correct 8 ms 9088 KB Output is correct
12 Correct 8 ms 9088 KB Output is correct
13 Correct 9 ms 9216 KB Output is correct
14 Correct 9 ms 9344 KB Output is correct
15 Incorrect 10 ms 9216 KB Output isn't correct
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 9088 KB Output is correct
2 Correct 8 ms 9088 KB Output is correct
3 Correct 8 ms 9088 KB Output is correct
4 Correct 9 ms 9216 KB Output is correct
5 Correct 8 ms 9088 KB Output is correct
6 Correct 8 ms 9088 KB Output is correct
7 Correct 8 ms 9088 KB Output is correct
8 Correct 8 ms 9088 KB Output is correct
9 Correct 8 ms 9088 KB Output is correct
10 Correct 8 ms 9216 KB Output is correct
11 Correct 9 ms 9088 KB Output is correct
12 Correct 8 ms 9088 KB Output is correct
13 Correct 8 ms 9088 KB Output is correct
14 Correct 9 ms 9088 KB Output is correct
15 Correct 9 ms 9216 KB Output is correct
16 Correct 8 ms 9216 KB Output is correct
17 Correct 9 ms 9192 KB Output is correct
18 Correct 8 ms 9088 KB Output is correct
19 Correct 9 ms 9216 KB Output is correct
20 Correct 9 ms 9188 KB Output is correct
21 Correct 9 ms 9088 KB Output is correct
22 Correct 9 ms 9216 KB Output is correct
23 Correct 8 ms 9216 KB Output is correct
24 Correct 9 ms 9088 KB Output is correct
25 Correct 9 ms 9216 KB Output is correct
26 Correct 10 ms 9088 KB Output is correct
27 Correct 10 ms 9216 KB Output is correct
28 Correct 11 ms 9216 KB Output is correct
29 Correct 11 ms 9088 KB Output is correct
30 Correct 9 ms 9088 KB Output is correct
31 Correct 10 ms 9088 KB Output is correct
32 Correct 11 ms 9088 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 9216 KB Output is correct
2 Correct 8 ms 9116 KB Output is correct
3 Correct 9 ms 9216 KB Output is correct
4 Correct 9 ms 9088 KB Output is correct
5 Correct 9 ms 9216 KB Output is correct
6 Correct 9 ms 9188 KB Output is correct
7 Correct 9 ms 9216 KB Output is correct
8 Correct 9 ms 9188 KB Output is correct
9 Correct 9 ms 9216 KB Output is correct
10 Correct 9 ms 9088 KB Output is correct
11 Correct 9 ms 9216 KB Output is correct
12 Correct 9 ms 9216 KB Output is correct
13 Correct 9 ms 9216 KB Output is correct
14 Correct 9 ms 9088 KB Output is correct
15 Incorrect 9 ms 9216 KB Output isn't correct
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 9216 KB Output is correct
2 Correct 9 ms 9216 KB Output is correct
3 Correct 9 ms 9216 KB Output is correct
4 Correct 9 ms 9216 KB Output is correct
5 Correct 9 ms 9216 KB Output is correct
6 Correct 9 ms 9088 KB Output is correct
7 Correct 9 ms 9216 KB Output is correct
8 Correct 9 ms 9216 KB Output is correct
9 Correct 9 ms 9216 KB Output is correct
10 Correct 10 ms 9216 KB Output is correct
11 Correct 9 ms 9216 KB Output is correct
12 Correct 9 ms 9088 KB Output is correct
13 Correct 9 ms 9216 KB Output is correct
14 Correct 9 ms 9216 KB Output is correct
15 Incorrect 9 ms 9088 KB Output isn't correct
16 Halted 0 ms 0 KB -