답안 #31754

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
31754 2017-09-06T03:58:11 Z aome K개의 묶음 (IZhO14_blocks) C++14
53 / 100
0 ms 2220 KB
#include <bits/stdc++.h>
using namespace std;

const int N = 105;
const int INF = 1e9;

int n, m, a[N], f[N][N];

int main() {
    ios::sync_with_stdio(false);
    cin >> n >> m;
    for (int i = 1; i <= n; ++i) cin >> a[i];
    for (int i = 0; i <= m; ++i) for (int j = 0; j <= n; ++j) f[i][j] = INF;
    f[0][0] = 0;
    for (int i = 1; i <= m; ++i) {
        for (int j = 1; j <= n; ++j) {
            int mx = 0;
            for (int k = j; k >= 1; --k) {
                mx = max(mx, a[k]);
                f[i][j] = min(f[i][j], f[i - 1][k - 1] + mx);
            }
        }
    }
    cout << f[m][n];
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2220 KB Output is correct
2 Correct 0 ms 2220 KB Output is correct
3 Correct 0 ms 2220 KB Output is correct
4 Correct 0 ms 2220 KB Output is correct
5 Correct 0 ms 2220 KB Output is correct
6 Correct 0 ms 2220 KB Output is correct
7 Correct 0 ms 2220 KB Output is correct
8 Correct 0 ms 2220 KB Output is correct
9 Correct 0 ms 2220 KB Output is correct
10 Correct 0 ms 2220 KB Output is correct
11 Correct 0 ms 2220 KB Output is correct
12 Correct 0 ms 2220 KB Output is correct
13 Correct 0 ms 2220 KB Output is correct
14 Correct 0 ms 2220 KB Output is correct
15 Correct 0 ms 2220 KB Output is correct
16 Correct 0 ms 2220 KB Output is correct
17 Correct 0 ms 2220 KB Output is correct
18 Correct 0 ms 2220 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2220 KB Output is correct
2 Correct 0 ms 2220 KB Output is correct
3 Correct 0 ms 2220 KB Output is correct
4 Correct 0 ms 2220 KB Output is correct
5 Correct 0 ms 2220 KB Output is correct
6 Correct 0 ms 2220 KB Output is correct
7 Correct 0 ms 2220 KB Output is correct
8 Correct 0 ms 2220 KB Output is correct
9 Correct 0 ms 2220 KB Output is correct
10 Correct 0 ms 2220 KB Output is correct
11 Correct 0 ms 2220 KB Output is correct
12 Correct 0 ms 2220 KB Output is correct
13 Correct 0 ms 2220 KB Output is correct
14 Correct 0 ms 2220 KB Output is correct
15 Correct 0 ms 2220 KB Output is correct
16 Correct 0 ms 2220 KB Output is correct
17 Correct 0 ms 2220 KB Output is correct
18 Correct 0 ms 2220 KB Output is correct
19 Correct 0 ms 2220 KB Output is correct
20 Correct 0 ms 2220 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2220 KB Output is correct
2 Correct 0 ms 2220 KB Output is correct
3 Correct 0 ms 2220 KB Output is correct
4 Correct 0 ms 2220 KB Output is correct
5 Correct 0 ms 2220 KB Output is correct
6 Correct 0 ms 2220 KB Output is correct
7 Correct 0 ms 2220 KB Output is correct
8 Correct 0 ms 2220 KB Output is correct
9 Correct 0 ms 2220 KB Output is correct
10 Correct 0 ms 2220 KB Output is correct
11 Correct 0 ms 2220 KB Output is correct
12 Correct 0 ms 2220 KB Output is correct
13 Correct 0 ms 2220 KB Output is correct
14 Correct 0 ms 2220 KB Output is correct
15 Correct 0 ms 2220 KB Output is correct
16 Correct 0 ms 2220 KB Output is correct
17 Correct 0 ms 2220 KB Output is correct
18 Correct 0 ms 2220 KB Output is correct
19 Correct 0 ms 2220 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 2220 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -