답안 #119114

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
119114 2019-06-20T11:44:02 Z Charis02 Bali Sculptures (APIO15_sculpture) C++14
21 / 100
11 ms 4736 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])
        return dp[cur][start][g];

  //  cout << cur << " " << start << " " << g << endl;

    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;

    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 2 ms 384 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 512 KB Output is correct
7 Correct 2 ms 512 KB Output is correct
8 Correct 2 ms 640 KB Output is correct
9 Correct 2 ms 512 KB Output is correct
10 Correct 2 ms 640 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 2 ms 512 KB Output is correct
13 Correct 3 ms 632 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Incorrect 2 ms 384 KB Output isn't correct
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 512 KB Output is correct
7 Correct 2 ms 512 KB Output is correct
8 Correct 2 ms 512 KB Output is correct
9 Correct 3 ms 640 KB Output is correct
10 Correct 2 ms 512 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 2 ms 512 KB Output is correct
13 Correct 2 ms 640 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Incorrect 2 ms 384 KB Output isn't correct
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 11 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 512 KB Output is correct
7 Correct 2 ms 512 KB Output is correct
8 Correct 2 ms 512 KB Output is correct
9 Correct 2 ms 640 KB Output is correct
10 Correct 2 ms 512 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 2 ms 640 KB Output is correct
13 Correct 2 ms 512 KB Output is correct
14 Correct 2 ms 640 KB Output is correct
15 Correct 2 ms 640 KB Output is correct
16 Correct 2 ms 1024 KB Output is correct
17 Correct 3 ms 1280 KB Output is correct
18 Correct 3 ms 1536 KB Output is correct
19 Correct 4 ms 1536 KB Output is correct
20 Correct 2 ms 512 KB Output is correct
21 Correct 3 ms 1536 KB Output is correct
22 Correct 3 ms 1536 KB Output is correct
23 Correct 3 ms 1536 KB Output is correct
24 Correct 3 ms 1536 KB Output is correct
25 Correct 4 ms 2304 KB Output is correct
26 Correct 5 ms 3072 KB Output is correct
27 Correct 8 ms 4096 KB Output is correct
28 Correct 8 ms 4736 KB Output is correct
29 Correct 9 ms 4724 KB Output is correct
30 Correct 2 ms 768 KB Output is correct
31 Correct 8 ms 4736 KB Output is correct
32 Correct 8 ms 4736 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 512 KB Output is correct
7 Correct 2 ms 512 KB Output is correct
8 Correct 2 ms 640 KB Output is correct
9 Correct 2 ms 640 KB Output is correct
10 Correct 2 ms 512 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 2 ms 640 KB Output is correct
13 Correct 2 ms 512 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Incorrect 2 ms 384 KB Output isn't correct
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 512 KB Output is correct
7 Correct 2 ms 512 KB Output is correct
8 Correct 2 ms 512 KB Output is correct
9 Correct 3 ms 768 KB Output is correct
10 Correct 2 ms 640 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 3 ms 512 KB Output is correct
13 Correct 2 ms 512 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Incorrect 2 ms 384 KB Output isn't correct
16 Halted 0 ms 0 KB -