답안 #207111

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
207111 2020-03-06T13:59:23 Z vardan__02 K개의 묶음 (IZhO14_blocks) C++14
53 / 100
597 ms 18912 KB
#include <algorithm>
#include <iostream>
#include <fstream>
#include <cstring>
#include <string>
#include <vector>
#include <cstdio>
#include <queue>
#include <deque>
#include <stack>
#include <list>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
const long long N=105;
const long long inf=1e18;
#define MP make_pair
#define PB push_back
ll n,m,i,j,k,ans[N][N][N],a[N],x;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin>>n>>k;
    for(i=1;i<=n;i++)
        cin>>a[i];
    for(i=1;i<=n;i++)
        for(j=i;j<=n;j++)
            for(x=i;x<=j;x++)
                ans[i][j][1]=max(ans[i][j][1],a[x]);
    for(ll qanak=1;qanak<=k;qanak++)
    {
        for(i=1;i<=n;i++)
        {
            for(j=i;j<=n;j++)
            {
                ans[i][j][qanak+1]=inf;
                for(x=i;x<=j-qanak;x++)
                    ans[i][j][qanak+1]=min(ans[i][j][qanak+1],ans[i][x][1]+ans[x+1][j][qanak]);
            }
        }
    }
    cout<<ans[1][n][k]<<endl;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 4 ms 376 KB Output is correct
6 Correct 5 ms 504 KB Output is correct
7 Correct 5 ms 376 KB Output is correct
8 Correct 5 ms 376 KB Output is correct
9 Correct 5 ms 376 KB Output is correct
10 Correct 5 ms 376 KB Output is correct
11 Correct 5 ms 376 KB Output is correct
12 Correct 8 ms 4856 KB Output is correct
13 Correct 9 ms 4852 KB Output is correct
14 Correct 10 ms 4856 KB Output is correct
15 Correct 8 ms 4856 KB Output is correct
16 Correct 9 ms 4856 KB Output is correct
17 Correct 8 ms 4856 KB Output is correct
18 Correct 9 ms 4856 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 5 ms 376 KB Output is correct
6 Correct 5 ms 376 KB Output is correct
7 Correct 5 ms 376 KB Output is correct
8 Correct 5 ms 376 KB Output is correct
9 Correct 5 ms 376 KB Output is correct
10 Correct 5 ms 376 KB Output is correct
11 Correct 5 ms 376 KB Output is correct
12 Correct 5 ms 376 KB Output is correct
13 Correct 5 ms 376 KB Output is correct
14 Correct 5 ms 632 KB Output is correct
15 Correct 6 ms 632 KB Output is correct
16 Correct 5 ms 504 KB Output is correct
17 Correct 5 ms 632 KB Output is correct
18 Correct 5 ms 632 KB Output is correct
19 Correct 5 ms 504 KB Output is correct
20 Correct 5 ms 504 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 15 ms 4856 KB Output is correct
2 Correct 5 ms 380 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 5 ms 380 KB Output is correct
6 Correct 5 ms 376 KB Output is correct
7 Correct 5 ms 376 KB Output is correct
8 Correct 5 ms 376 KB Output is correct
9 Correct 5 ms 376 KB Output is correct
10 Correct 5 ms 376 KB Output is correct
11 Correct 5 ms 376 KB Output is correct
12 Correct 5 ms 376 KB Output is correct
13 Correct 13 ms 4856 KB Output is correct
14 Correct 13 ms 4856 KB Output is correct
15 Correct 17 ms 4856 KB Output is correct
16 Correct 17 ms 4984 KB Output is correct
17 Correct 16 ms 4836 KB Output is correct
18 Correct 18 ms 4856 KB Output is correct
19 Correct 19 ms 4856 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 597 ms 18912 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -