Submission #312208

# Submission time Handle Problem Language Result Execution time Memory
312208 2020-10-12T17:29:50 Z tevdore K blocks (IZhO14_blocks) C++14
53 / 100
1000 ms 79608 KB
#include<bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int n, k;
long long a[N], dp[N][101];
int main() {
    cin >> n >> k;
    for(int i = 1; i <= n; i++) cin >> a[i];
    for(int i = 0; i <= N - 1; i++) {
        for(int j = 0; j <= 100; j++) dp[i][j] = 1e18;
    }
    dp[0][0] = 0;
    long long mx = 0;
    for(int i = 1; i <= n; i++) {
        for(int j = 1; j <= k; j++) {
            mx = a[i];
            for(int l = i - 1; l >= j - 1; l--) {
                dp[i][j] = min(dp[i][j], dp[l][j - 1] + mx);
                mx = max(mx, a[l]);
            }
        }
    }
    cout << dp[n][k] << "\n";
}
# Verdict Execution time Memory Grader output
1 Correct 44 ms 79352 KB Output is correct
2 Correct 43 ms 79356 KB Output is correct
3 Correct 49 ms 79352 KB Output is correct
4 Correct 44 ms 79444 KB Output is correct
5 Correct 43 ms 79352 KB Output is correct
6 Correct 43 ms 79352 KB Output is correct
7 Correct 44 ms 79340 KB Output is correct
8 Correct 43 ms 79352 KB Output is correct
9 Correct 44 ms 79360 KB Output is correct
10 Correct 43 ms 79352 KB Output is correct
11 Correct 43 ms 79352 KB Output is correct
12 Correct 43 ms 79352 KB Output is correct
13 Correct 43 ms 79352 KB Output is correct
14 Correct 43 ms 79352 KB Output is correct
15 Correct 43 ms 79352 KB Output is correct
16 Correct 43 ms 79352 KB Output is correct
17 Correct 43 ms 79352 KB Output is correct
18 Correct 43 ms 79352 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 44 ms 79352 KB Output is correct
2 Correct 43 ms 79360 KB Output is correct
3 Correct 43 ms 79352 KB Output is correct
4 Correct 43 ms 79448 KB Output is correct
5 Correct 43 ms 79352 KB Output is correct
6 Correct 44 ms 79404 KB Output is correct
7 Correct 43 ms 79480 KB Output is correct
8 Correct 43 ms 79352 KB Output is correct
9 Correct 43 ms 79352 KB Output is correct
10 Correct 43 ms 79352 KB Output is correct
11 Correct 44 ms 79352 KB Output is correct
12 Correct 43 ms 79352 KB Output is correct
13 Correct 43 ms 79480 KB Output is correct
14 Correct 44 ms 79352 KB Output is correct
15 Correct 43 ms 79352 KB Output is correct
16 Correct 43 ms 79352 KB Output is correct
17 Correct 43 ms 79352 KB Output is correct
18 Correct 43 ms 79480 KB Output is correct
19 Correct 45 ms 79352 KB Output is correct
20 Correct 43 ms 79352 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 44 ms 79352 KB Output is correct
2 Correct 43 ms 79356 KB Output is correct
3 Correct 49 ms 79352 KB Output is correct
4 Correct 44 ms 79444 KB Output is correct
5 Correct 43 ms 79352 KB Output is correct
6 Correct 43 ms 79352 KB Output is correct
7 Correct 44 ms 79340 KB Output is correct
8 Correct 43 ms 79352 KB Output is correct
9 Correct 44 ms 79360 KB Output is correct
10 Correct 43 ms 79352 KB Output is correct
11 Correct 43 ms 79352 KB Output is correct
12 Correct 43 ms 79352 KB Output is correct
13 Correct 43 ms 79352 KB Output is correct
14 Correct 43 ms 79352 KB Output is correct
15 Correct 43 ms 79352 KB Output is correct
16 Correct 43 ms 79352 KB Output is correct
17 Correct 43 ms 79352 KB Output is correct
18 Correct 43 ms 79352 KB Output is correct
19 Correct 44 ms 79352 KB Output is correct
20 Correct 43 ms 79360 KB Output is correct
21 Correct 43 ms 79352 KB Output is correct
22 Correct 43 ms 79448 KB Output is correct
23 Correct 43 ms 79352 KB Output is correct
24 Correct 44 ms 79404 KB Output is correct
25 Correct 43 ms 79480 KB Output is correct
26 Correct 43 ms 79352 KB Output is correct
27 Correct 43 ms 79352 KB Output is correct
28 Correct 43 ms 79352 KB Output is correct
29 Correct 44 ms 79352 KB Output is correct
30 Correct 43 ms 79352 KB Output is correct
31 Correct 43 ms 79480 KB Output is correct
32 Correct 44 ms 79352 KB Output is correct
33 Correct 43 ms 79352 KB Output is correct
34 Correct 43 ms 79352 KB Output is correct
35 Correct 43 ms 79352 KB Output is correct
36 Correct 43 ms 79480 KB Output is correct
37 Correct 45 ms 79352 KB Output is correct
38 Correct 43 ms 79352 KB Output is correct
39 Correct 45 ms 79352 KB Output is correct
40 Correct 44 ms 79356 KB Output is correct
41 Correct 43 ms 79352 KB Output is correct
42 Correct 45 ms 79352 KB Output is correct
43 Correct 44 ms 79352 KB Output is correct
44 Correct 45 ms 79480 KB Output is correct
45 Correct 43 ms 79352 KB Output is correct
46 Correct 44 ms 79352 KB Output is correct
47 Correct 45 ms 79352 KB Output is correct
48 Correct 44 ms 79480 KB Output is correct
49 Correct 44 ms 79352 KB Output is correct
50 Correct 44 ms 79352 KB Output is correct
51 Correct 55 ms 79352 KB Output is correct
52 Correct 43 ms 79352 KB Output is correct
53 Correct 45 ms 79480 KB Output is correct
54 Correct 45 ms 79352 KB Output is correct
55 Correct 45 ms 79352 KB Output is correct
56 Correct 44 ms 79352 KB Output is correct
57 Correct 44 ms 79352 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 44 ms 79352 KB Output is correct
2 Correct 43 ms 79356 KB Output is correct
3 Correct 49 ms 79352 KB Output is correct
4 Correct 44 ms 79444 KB Output is correct
5 Correct 43 ms 79352 KB Output is correct
6 Correct 43 ms 79352 KB Output is correct
7 Correct 44 ms 79340 KB Output is correct
8 Correct 43 ms 79352 KB Output is correct
9 Correct 44 ms 79360 KB Output is correct
10 Correct 43 ms 79352 KB Output is correct
11 Correct 43 ms 79352 KB Output is correct
12 Correct 43 ms 79352 KB Output is correct
13 Correct 43 ms 79352 KB Output is correct
14 Correct 43 ms 79352 KB Output is correct
15 Correct 43 ms 79352 KB Output is correct
16 Correct 43 ms 79352 KB Output is correct
17 Correct 43 ms 79352 KB Output is correct
18 Correct 43 ms 79352 KB Output is correct
19 Correct 44 ms 79352 KB Output is correct
20 Correct 43 ms 79360 KB Output is correct
21 Correct 43 ms 79352 KB Output is correct
22 Correct 43 ms 79448 KB Output is correct
23 Correct 43 ms 79352 KB Output is correct
24 Correct 44 ms 79404 KB Output is correct
25 Correct 43 ms 79480 KB Output is correct
26 Correct 43 ms 79352 KB Output is correct
27 Correct 43 ms 79352 KB Output is correct
28 Correct 43 ms 79352 KB Output is correct
29 Correct 44 ms 79352 KB Output is correct
30 Correct 43 ms 79352 KB Output is correct
31 Correct 43 ms 79480 KB Output is correct
32 Correct 44 ms 79352 KB Output is correct
33 Correct 43 ms 79352 KB Output is correct
34 Correct 43 ms 79352 KB Output is correct
35 Correct 43 ms 79352 KB Output is correct
36 Correct 43 ms 79480 KB Output is correct
37 Correct 45 ms 79352 KB Output is correct
38 Correct 43 ms 79352 KB Output is correct
39 Correct 45 ms 79352 KB Output is correct
40 Correct 44 ms 79356 KB Output is correct
41 Correct 43 ms 79352 KB Output is correct
42 Correct 45 ms 79352 KB Output is correct
43 Correct 44 ms 79352 KB Output is correct
44 Correct 45 ms 79480 KB Output is correct
45 Correct 43 ms 79352 KB Output is correct
46 Correct 44 ms 79352 KB Output is correct
47 Correct 45 ms 79352 KB Output is correct
48 Correct 44 ms 79480 KB Output is correct
49 Correct 44 ms 79352 KB Output is correct
50 Correct 44 ms 79352 KB Output is correct
51 Correct 55 ms 79352 KB Output is correct
52 Correct 43 ms 79352 KB Output is correct
53 Correct 45 ms 79480 KB Output is correct
54 Correct 45 ms 79352 KB Output is correct
55 Correct 45 ms 79352 KB Output is correct
56 Correct 44 ms 79352 KB Output is correct
57 Correct 44 ms 79352 KB Output is correct
58 Execution timed out 1086 ms 79608 KB Time limit exceeded
59 Halted 0 ms 0 KB -