답안 #895136

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
895136 2023-12-29T13:19:19 Z vjudge1 Rabbit Carrot (LMIO19_triusis) C++17
63 / 100
33 ms 98424 KB
#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math,inline")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,lzcnt,mmx,abm,avx,avx2,fma")
#include <bits/stdc++.h>
using namespace std;

const int N = 5e3+3, inf = INT_MAX;

int n, m, mx, a[N], dp[N][N];
// dp[i][j] = altura maxima que puedes conseguir en la plataforma i con j movimientos

signed main() {
  ios::sync_with_stdio(false); cin.tie(nullptr);

  cin >> n >> m;
  a[0] = 0;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }

  dp[0][0] = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= i; j++) {
      int x = -inf;
      if (dp[i-1][j] + m >= a[i]) x = max(x, a[i]);
      if (j && dp[i-1][j-1] != -inf) x = max(x, dp[i-1][j-1] + m);
      dp[i][j] = x;
    }
  }

  int ans = inf;
  for (int i = 0; i <= n; i++) {
    if (dp[n][i] != -inf) {
      ans = i;
      break;
    }
  }
  cout << ans << "\n";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 2392 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 0 ms 2396 KB Output is correct
7 Correct 0 ms 2396 KB Output is correct
8 Correct 0 ms 2396 KB Output is correct
9 Correct 1 ms 2392 KB Output is correct
10 Correct 1 ms 2392 KB Output is correct
11 Correct 1 ms 2396 KB Output is correct
12 Correct 0 ms 2396 KB Output is correct
13 Correct 0 ms 2396 KB Output is correct
14 Correct 1 ms 2396 KB Output is correct
15 Correct 0 ms 2396 KB Output is correct
16 Correct 0 ms 2396 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 2392 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 0 ms 2396 KB Output is correct
7 Correct 0 ms 2396 KB Output is correct
8 Correct 0 ms 2396 KB Output is correct
9 Correct 1 ms 2392 KB Output is correct
10 Correct 1 ms 2392 KB Output is correct
11 Correct 1 ms 2396 KB Output is correct
12 Correct 0 ms 2396 KB Output is correct
13 Correct 0 ms 2396 KB Output is correct
14 Correct 1 ms 2396 KB Output is correct
15 Correct 0 ms 2396 KB Output is correct
16 Correct 0 ms 2396 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 1 ms 344 KB Output is correct
20 Correct 20 ms 80476 KB Output is correct
21 Correct 28 ms 98216 KB Output is correct
22 Correct 28 ms 98132 KB Output is correct
23 Correct 33 ms 98188 KB Output is correct
24 Correct 28 ms 98132 KB Output is correct
25 Correct 28 ms 98128 KB Output is correct
26 Correct 28 ms 98140 KB Output is correct
27 Correct 28 ms 98132 KB Output is correct
28 Correct 28 ms 98132 KB Output is correct
29 Correct 28 ms 98140 KB Output is correct
30 Correct 29 ms 98128 KB Output is correct
31 Correct 29 ms 98140 KB Output is correct
32 Correct 32 ms 98184 KB Output is correct
33 Correct 28 ms 98140 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 20 ms 80476 KB Output is correct
5 Correct 28 ms 98216 KB Output is correct
6 Correct 28 ms 98132 KB Output is correct
7 Correct 33 ms 98188 KB Output is correct
8 Correct 28 ms 98132 KB Output is correct
9 Correct 28 ms 98128 KB Output is correct
10 Correct 28 ms 98140 KB Output is correct
11 Correct 28 ms 98132 KB Output is correct
12 Correct 28 ms 98132 KB Output is correct
13 Correct 28 ms 98140 KB Output is correct
14 Correct 29 ms 98128 KB Output is correct
15 Correct 29 ms 98140 KB Output is correct
16 Correct 32 ms 98184 KB Output is correct
17 Correct 28 ms 98140 KB Output is correct
18 Correct 0 ms 344 KB Output is correct
19 Correct 0 ms 344 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 2392 KB Output is correct
22 Correct 1 ms 2396 KB Output is correct
23 Correct 0 ms 2396 KB Output is correct
24 Correct 0 ms 2396 KB Output is correct
25 Correct 0 ms 2396 KB Output is correct
26 Correct 1 ms 2392 KB Output is correct
27 Correct 1 ms 2392 KB Output is correct
28 Correct 1 ms 2396 KB Output is correct
29 Correct 0 ms 2396 KB Output is correct
30 Correct 0 ms 2396 KB Output is correct
31 Correct 1 ms 2396 KB Output is correct
32 Correct 0 ms 2396 KB Output is correct
33 Correct 0 ms 2396 KB Output is correct
34 Correct 28 ms 98196 KB Output is correct
35 Correct 29 ms 98132 KB Output is correct
36 Correct 28 ms 98140 KB Output is correct
37 Correct 29 ms 98184 KB Output is correct
38 Correct 28 ms 98140 KB Output is correct
39 Correct 29 ms 98108 KB Output is correct
40 Correct 28 ms 98140 KB Output is correct
41 Correct 32 ms 98424 KB Output is correct
42 Correct 30 ms 98232 KB Output is correct
43 Correct 28 ms 98212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 28 ms 98196 KB Output is correct
2 Correct 29 ms 98132 KB Output is correct
3 Correct 28 ms 98140 KB Output is correct
4 Correct 29 ms 98184 KB Output is correct
5 Correct 28 ms 98140 KB Output is correct
6 Correct 29 ms 98108 KB Output is correct
7 Correct 28 ms 98140 KB Output is correct
8 Correct 32 ms 98424 KB Output is correct
9 Correct 30 ms 98232 KB Output is correct
10 Correct 28 ms 98212 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 20 ms 80476 KB Output is correct
15 Correct 28 ms 98216 KB Output is correct
16 Correct 28 ms 98132 KB Output is correct
17 Correct 33 ms 98188 KB Output is correct
18 Correct 28 ms 98132 KB Output is correct
19 Correct 28 ms 98128 KB Output is correct
20 Correct 28 ms 98140 KB Output is correct
21 Correct 28 ms 98132 KB Output is correct
22 Correct 28 ms 98132 KB Output is correct
23 Correct 28 ms 98140 KB Output is correct
24 Correct 29 ms 98128 KB Output is correct
25 Correct 29 ms 98140 KB Output is correct
26 Correct 32 ms 98184 KB Output is correct
27 Correct 28 ms 98140 KB Output is correct
28 Correct 0 ms 344 KB Output is correct
29 Correct 0 ms 344 KB Output is correct
30 Correct 0 ms 348 KB Output is correct
31 Correct 0 ms 2392 KB Output is correct
32 Correct 1 ms 2396 KB Output is correct
33 Correct 0 ms 2396 KB Output is correct
34 Correct 0 ms 2396 KB Output is correct
35 Correct 0 ms 2396 KB Output is correct
36 Correct 1 ms 2392 KB Output is correct
37 Correct 1 ms 2392 KB Output is correct
38 Correct 1 ms 2396 KB Output is correct
39 Correct 0 ms 2396 KB Output is correct
40 Correct 0 ms 2396 KB Output is correct
41 Correct 1 ms 2396 KB Output is correct
42 Correct 0 ms 2396 KB Output is correct
43 Correct 0 ms 2396 KB Output is correct
44 Correct 0 ms 344 KB Output is correct
45 Runtime error 3 ms 604 KB Execution killed with signal 11
46 Halted 0 ms 0 KB -