Submission #799556

# Submission time Handle Problem Language Result Execution time Memory
799556 2023-07-31T15:57:29 Z vjudge1 Rabbit Carrot (LMIO19_triusis) C++17
35 / 100
115 ms 196436 KB
#include <iostream>
#include <cstring>
using namespace std;
int a[5005], f[5005][5005], g[5005][5005];
int main() {
    int n, m;
    cin >> n >> m;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
    }
    memset(f, 0x3f, sizeof f);
    memset(g, 0x3f, sizeof g);
    int mi = 999999999;
    f[0][0] = g[0][0] = 0;
    for (int i = 1; i <= n; i++) {
        for (int j = 5000; j >= 0; j--) {
            f[i][j] = g[i - 1][max(0, j - m)];
            if (j != a[i]) f[i][j]++;
            g[i][j] = min(g[i][j + 1], f[i][j]);
        }
    }
    for (int i = 5000; i >= 0; i--) mi = min(mi, f[n][i]);
    cout << mi;
}
# Verdict Execution time Memory Grader output
1 Correct 96 ms 196336 KB Output is correct
2 Correct 90 ms 196360 KB Output is correct
3 Correct 79 ms 196344 KB Output is correct
4 Correct 71 ms 196272 KB Output is correct
5 Correct 65 ms 196320 KB Output is correct
6 Correct 67 ms 196284 KB Output is correct
7 Correct 68 ms 196344 KB Output is correct
8 Correct 73 ms 196324 KB Output is correct
9 Correct 81 ms 196348 KB Output is correct
10 Correct 67 ms 196352 KB Output is correct
11 Correct 64 ms 196368 KB Output is correct
12 Correct 65 ms 196300 KB Output is correct
13 Correct 72 ms 196300 KB Output is correct
14 Correct 69 ms 196360 KB Output is correct
15 Correct 81 ms 196276 KB Output is correct
16 Correct 70 ms 196344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 96 ms 196336 KB Output is correct
2 Correct 90 ms 196360 KB Output is correct
3 Correct 79 ms 196344 KB Output is correct
4 Correct 71 ms 196272 KB Output is correct
5 Correct 65 ms 196320 KB Output is correct
6 Correct 67 ms 196284 KB Output is correct
7 Correct 68 ms 196344 KB Output is correct
8 Correct 73 ms 196324 KB Output is correct
9 Correct 81 ms 196348 KB Output is correct
10 Correct 67 ms 196352 KB Output is correct
11 Correct 64 ms 196368 KB Output is correct
12 Correct 65 ms 196300 KB Output is correct
13 Correct 72 ms 196300 KB Output is correct
14 Correct 69 ms 196360 KB Output is correct
15 Correct 81 ms 196276 KB Output is correct
16 Correct 70 ms 196344 KB Output is correct
17 Correct 68 ms 196292 KB Output is correct
18 Correct 68 ms 196324 KB Output is correct
19 Correct 68 ms 196264 KB Output is correct
20 Correct 110 ms 196316 KB Output is correct
21 Correct 104 ms 196300 KB Output is correct
22 Correct 106 ms 196412 KB Output is correct
23 Correct 104 ms 196356 KB Output is correct
24 Correct 111 ms 196408 KB Output is correct
25 Correct 106 ms 196412 KB Output is correct
26 Correct 105 ms 196408 KB Output is correct
27 Correct 107 ms 196336 KB Output is correct
28 Correct 104 ms 196404 KB Output is correct
29 Correct 105 ms 196292 KB Output is correct
30 Correct 104 ms 196400 KB Output is correct
31 Correct 115 ms 196296 KB Output is correct
32 Correct 106 ms 196304 KB Output is correct
33 Correct 105 ms 196408 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 68 ms 196292 KB Output is correct
2 Correct 68 ms 196324 KB Output is correct
3 Correct 68 ms 196264 KB Output is correct
4 Correct 110 ms 196316 KB Output is correct
5 Correct 104 ms 196300 KB Output is correct
6 Correct 106 ms 196412 KB Output is correct
7 Correct 104 ms 196356 KB Output is correct
8 Correct 111 ms 196408 KB Output is correct
9 Correct 106 ms 196412 KB Output is correct
10 Correct 105 ms 196408 KB Output is correct
11 Correct 107 ms 196336 KB Output is correct
12 Correct 104 ms 196404 KB Output is correct
13 Correct 105 ms 196292 KB Output is correct
14 Correct 104 ms 196400 KB Output is correct
15 Correct 115 ms 196296 KB Output is correct
16 Correct 106 ms 196304 KB Output is correct
17 Correct 105 ms 196408 KB Output is correct
18 Correct 96 ms 196336 KB Output is correct
19 Correct 90 ms 196360 KB Output is correct
20 Correct 79 ms 196344 KB Output is correct
21 Correct 71 ms 196272 KB Output is correct
22 Correct 65 ms 196320 KB Output is correct
23 Correct 67 ms 196284 KB Output is correct
24 Correct 68 ms 196344 KB Output is correct
25 Correct 73 ms 196324 KB Output is correct
26 Correct 81 ms 196348 KB Output is correct
27 Correct 67 ms 196352 KB Output is correct
28 Correct 64 ms 196368 KB Output is correct
29 Correct 65 ms 196300 KB Output is correct
30 Correct 72 ms 196300 KB Output is correct
31 Correct 69 ms 196360 KB Output is correct
32 Correct 81 ms 196276 KB Output is correct
33 Correct 70 ms 196344 KB Output is correct
34 Correct 105 ms 196332 KB Output is correct
35 Incorrect 107 ms 196436 KB Output isn't correct
36 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 105 ms 196332 KB Output is correct
2 Incorrect 107 ms 196436 KB Output isn't correct
3 Halted 0 ms 0 KB -