# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
701343 | 2023-02-21T02:53:01 Z | Do_you_copy | K개의 묶음 (IZhO14_blocks) | C++17 | 1000 ms | 79432 KB |
#include <bits/stdc++.h> #define fi first #define se second #define faster ios_base::sync_with_stdio(0); cin.tie(0); #define pb push_back #define int long long using namespace std; using ll = long long; using pii = pair <int, int>; const int maxN = 1e5 + 1; const int inf = 0x3f3f3f3f3f3f3f3f; //const int Mod = int n, k; int a[maxN]; ll dp[maxN][101]; void Init(){ cin >> n >> k; memset(dp, 0x3f, sizeof(dp)); for (int i = 1; i <= n; ++i){ cin >> a[i]; } dp[0][0] = 0; for (int i = 1; i <= k; ++i){ for (int j = 1; j <= n; ++j){ int maxx = 0; for (int g = j; g >= 1; --g){ maxx = max(maxx, a[g]); dp[j][i] = min(dp[j][i], dp[g - 1][i - 1] + maxx); } } } cout << dp[n][k]; } #define taskname "test" signed main(){ faster if (fopen(taskname ".inp", "r")){ freopen(taskname ".inp", "r", stdin); freopen(taskname ".ans", "w", stdout); } int tt = 1; //cin >> tt; while (tt--){ Init(); } if (fopen("timeout.txt", "r")){ ofstream timeout("timeout.txt"); cerr << "Time elapsed: " << signed(double(clock()) / CLOCKS_PER_SEC * 1000) << "ms\n"; timeout << signed(double(clock()) / CLOCKS_PER_SEC * 1000); timeout.close(); } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 38 ms | 79264 KB | Output is correct |
2 | Correct | 31 ms | 79320 KB | Output is correct |
3 | Correct | 31 ms | 79300 KB | Output is correct |
4 | Correct | 30 ms | 79308 KB | Output is correct |
5 | Correct | 31 ms | 79300 KB | Output is correct |
6 | Correct | 35 ms | 79356 KB | Output is correct |
7 | Correct | 30 ms | 79356 KB | Output is correct |
8 | Correct | 31 ms | 79296 KB | Output is correct |
9 | Correct | 32 ms | 79268 KB | Output is correct |
10 | Correct | 34 ms | 79384 KB | Output is correct |
11 | Correct | 35 ms | 79360 KB | Output is correct |
12 | Correct | 31 ms | 79252 KB | Output is correct |
13 | Correct | 31 ms | 79296 KB | Output is correct |
14 | Correct | 31 ms | 79288 KB | Output is correct |
15 | Correct | 31 ms | 79308 KB | Output is correct |
16 | Correct | 31 ms | 79308 KB | Output is correct |
17 | Correct | 32 ms | 79336 KB | Output is correct |
18 | Correct | 31 ms | 79252 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 32 ms | 79356 KB | Output is correct |
2 | Correct | 31 ms | 79320 KB | Output is correct |
3 | Correct | 38 ms | 79324 KB | Output is correct |
4 | Correct | 37 ms | 79308 KB | Output is correct |
5 | Correct | 31 ms | 79324 KB | Output is correct |
6 | Correct | 30 ms | 79248 KB | Output is correct |
7 | Correct | 38 ms | 79340 KB | Output is correct |
8 | Correct | 32 ms | 79256 KB | Output is correct |
9 | Correct | 31 ms | 79288 KB | Output is correct |
10 | Correct | 31 ms | 79340 KB | Output is correct |
11 | Correct | 33 ms | 79392 KB | Output is correct |
12 | Correct | 30 ms | 79308 KB | Output is correct |
13 | Correct | 30 ms | 79316 KB | Output is correct |
14 | Correct | 35 ms | 79336 KB | Output is correct |
15 | Correct | 29 ms | 79304 KB | Output is correct |
16 | Correct | 31 ms | 79316 KB | Output is correct |
17 | Correct | 32 ms | 79324 KB | Output is correct |
18 | Correct | 33 ms | 79260 KB | Output is correct |
19 | Correct | 31 ms | 79324 KB | Output is correct |
20 | Correct | 30 ms | 79324 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 38 ms | 79264 KB | Output is correct |
2 | Correct | 31 ms | 79320 KB | Output is correct |
3 | Correct | 31 ms | 79300 KB | Output is correct |
4 | Correct | 30 ms | 79308 KB | Output is correct |
5 | Correct | 31 ms | 79300 KB | Output is correct |
6 | Correct | 35 ms | 79356 KB | Output is correct |
7 | Correct | 30 ms | 79356 KB | Output is correct |
8 | Correct | 31 ms | 79296 KB | Output is correct |
9 | Correct | 32 ms | 79268 KB | Output is correct |
10 | Correct | 34 ms | 79384 KB | Output is correct |
11 | Correct | 35 ms | 79360 KB | Output is correct |
12 | Correct | 31 ms | 79252 KB | Output is correct |
13 | Correct | 31 ms | 79296 KB | Output is correct |
14 | Correct | 31 ms | 79288 KB | Output is correct |
15 | Correct | 31 ms | 79308 KB | Output is correct |
16 | Correct | 31 ms | 79308 KB | Output is correct |
17 | Correct | 32 ms | 79336 KB | Output is correct |
18 | Correct | 31 ms | 79252 KB | Output is correct |
19 | Correct | 32 ms | 79356 KB | Output is correct |
20 | Correct | 31 ms | 79320 KB | Output is correct |
21 | Correct | 38 ms | 79324 KB | Output is correct |
22 | Correct | 37 ms | 79308 KB | Output is correct |
23 | Correct | 31 ms | 79324 KB | Output is correct |
24 | Correct | 30 ms | 79248 KB | Output is correct |
25 | Correct | 38 ms | 79340 KB | Output is correct |
26 | Correct | 32 ms | 79256 KB | Output is correct |
27 | Correct | 31 ms | 79288 KB | Output is correct |
28 | Correct | 31 ms | 79340 KB | Output is correct |
29 | Correct | 33 ms | 79392 KB | Output is correct |
30 | Correct | 30 ms | 79308 KB | Output is correct |
31 | Correct | 30 ms | 79316 KB | Output is correct |
32 | Correct | 35 ms | 79336 KB | Output is correct |
33 | Correct | 29 ms | 79304 KB | Output is correct |
34 | Correct | 31 ms | 79316 KB | Output is correct |
35 | Correct | 32 ms | 79324 KB | Output is correct |
36 | Correct | 33 ms | 79260 KB | Output is correct |
37 | Correct | 31 ms | 79324 KB | Output is correct |
38 | Correct | 30 ms | 79324 KB | Output is correct |
39 | Correct | 31 ms | 79280 KB | Output is correct |
40 | Correct | 30 ms | 79324 KB | Output is correct |
41 | Correct | 34 ms | 79256 KB | Output is correct |
42 | Correct | 34 ms | 79252 KB | Output is correct |
43 | Correct | 31 ms | 79296 KB | Output is correct |
44 | Correct | 32 ms | 79352 KB | Output is correct |
45 | Correct | 37 ms | 79328 KB | Output is correct |
46 | Correct | 30 ms | 79328 KB | Output is correct |
47 | Correct | 35 ms | 79288 KB | Output is correct |
48 | Correct | 35 ms | 79364 KB | Output is correct |
49 | Correct | 31 ms | 79308 KB | Output is correct |
50 | Correct | 35 ms | 79272 KB | Output is correct |
51 | Correct | 39 ms | 79296 KB | Output is correct |
52 | Correct | 32 ms | 79272 KB | Output is correct |
53 | Correct | 32 ms | 79344 KB | Output is correct |
54 | Correct | 33 ms | 79292 KB | Output is correct |
55 | Correct | 34 ms | 79316 KB | Output is correct |
56 | Correct | 35 ms | 79252 KB | Output is correct |
57 | Correct | 34 ms | 79356 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 38 ms | 79264 KB | Output is correct |
2 | Correct | 31 ms | 79320 KB | Output is correct |
3 | Correct | 31 ms | 79300 KB | Output is correct |
4 | Correct | 30 ms | 79308 KB | Output is correct |
5 | Correct | 31 ms | 79300 KB | Output is correct |
6 | Correct | 35 ms | 79356 KB | Output is correct |
7 | Correct | 30 ms | 79356 KB | Output is correct |
8 | Correct | 31 ms | 79296 KB | Output is correct |
9 | Correct | 32 ms | 79268 KB | Output is correct |
10 | Correct | 34 ms | 79384 KB | Output is correct |
11 | Correct | 35 ms | 79360 KB | Output is correct |
12 | Correct | 31 ms | 79252 KB | Output is correct |
13 | Correct | 31 ms | 79296 KB | Output is correct |
14 | Correct | 31 ms | 79288 KB | Output is correct |
15 | Correct | 31 ms | 79308 KB | Output is correct |
16 | Correct | 31 ms | 79308 KB | Output is correct |
17 | Correct | 32 ms | 79336 KB | Output is correct |
18 | Correct | 31 ms | 79252 KB | Output is correct |
19 | Correct | 32 ms | 79356 KB | Output is correct |
20 | Correct | 31 ms | 79320 KB | Output is correct |
21 | Correct | 38 ms | 79324 KB | Output is correct |
22 | Correct | 37 ms | 79308 KB | Output is correct |
23 | Correct | 31 ms | 79324 KB | Output is correct |
24 | Correct | 30 ms | 79248 KB | Output is correct |
25 | Correct | 38 ms | 79340 KB | Output is correct |
26 | Correct | 32 ms | 79256 KB | Output is correct |
27 | Correct | 31 ms | 79288 KB | Output is correct |
28 | Correct | 31 ms | 79340 KB | Output is correct |
29 | Correct | 33 ms | 79392 KB | Output is correct |
30 | Correct | 30 ms | 79308 KB | Output is correct |
31 | Correct | 30 ms | 79316 KB | Output is correct |
32 | Correct | 35 ms | 79336 KB | Output is correct |
33 | Correct | 29 ms | 79304 KB | Output is correct |
34 | Correct | 31 ms | 79316 KB | Output is correct |
35 | Correct | 32 ms | 79324 KB | Output is correct |
36 | Correct | 33 ms | 79260 KB | Output is correct |
37 | Correct | 31 ms | 79324 KB | Output is correct |
38 | Correct | 30 ms | 79324 KB | Output is correct |
39 | Correct | 31 ms | 79280 KB | Output is correct |
40 | Correct | 30 ms | 79324 KB | Output is correct |
41 | Correct | 34 ms | 79256 KB | Output is correct |
42 | Correct | 34 ms | 79252 KB | Output is correct |
43 | Correct | 31 ms | 79296 KB | Output is correct |
44 | Correct | 32 ms | 79352 KB | Output is correct |
45 | Correct | 37 ms | 79328 KB | Output is correct |
46 | Correct | 30 ms | 79328 KB | Output is correct |
47 | Correct | 35 ms | 79288 KB | Output is correct |
48 | Correct | 35 ms | 79364 KB | Output is correct |
49 | Correct | 31 ms | 79308 KB | Output is correct |
50 | Correct | 35 ms | 79272 KB | Output is correct |
51 | Correct | 39 ms | 79296 KB | Output is correct |
52 | Correct | 32 ms | 79272 KB | Output is correct |
53 | Correct | 32 ms | 79344 KB | Output is correct |
54 | Correct | 33 ms | 79292 KB | Output is correct |
55 | Correct | 34 ms | 79316 KB | Output is correct |
56 | Correct | 35 ms | 79252 KB | Output is correct |
57 | Correct | 34 ms | 79356 KB | Output is correct |
58 | Execution timed out | 1094 ms | 79432 KB | Time limit exceeded |
59 | Halted | 0 ms | 0 KB | - |