답안 #1040648

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1040648 2024-08-01T08:10:05 Z lmaobruh Rabbit Carrot (LMIO19_triusis) C++14
63 / 100
1000 ms 2896 KB
// 027 072 207 270 702 720
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define all(x) x.begin(), x.end()
#define fo(i, a, b) for (int i = (a), b_ = (b); i <= b_; ++i)
#define fod(i, a, b) for (int i = (a), b_ = (b); i >= b_; --i)
#define rep(i, n) fo(i, 1, n)
#define per(i, n) fod(i, n, 1)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
const int N = 1e6+5;

int n, m, a[N], dp[N];
bool reach[N];

void sol() {
  cin >> n >> m;
  reach[0] = 1;
  rep(i, n) {
    cin >> a[i];
    for (int j = 0; j < i; ++j)
      if (a[j] >= a[i] - m * (i - j) && reach[j])
        chmax(dp[i], dp[j]+1);
    reach[i] = (dp[i] > 0);
  }
  cout << n - *max_element(dp+1, dp+n+1);
}

signed main() {
  cin.tie(0) -> sync_with_stdio(0);
  // if (fopen("A.inp", "r")) freopen("A.inp", "r", stdin);
  int tc = 1, test = 0; // cin >> tc;
  while (++test <= tc) sol();
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Correct 0 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 1 ms 2392 KB Output is correct
9 Correct 0 ms 2396 KB Output is correct
10 Correct 0 ms 2396 KB Output is correct
11 Correct 0 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 1 ms 2504 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Correct 0 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 1 ms 2392 KB Output is correct
9 Correct 0 ms 2396 KB Output is correct
10 Correct 0 ms 2396 KB Output is correct
11 Correct 0 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 1 ms 2504 KB Output is correct
17 Correct 1 ms 2396 KB Output is correct
18 Correct 1 ms 2396 KB Output is correct
19 Correct 0 ms 2396 KB Output is correct
20 Correct 6 ms 2396 KB Output is correct
21 Correct 17 ms 2556 KB Output is correct
22 Correct 26 ms 2548 KB Output is correct
23 Correct 9 ms 2396 KB Output is correct
24 Correct 10 ms 2568 KB Output is correct
25 Correct 10 ms 2396 KB Output is correct
26 Correct 10 ms 2396 KB Output is correct
27 Correct 24 ms 2392 KB Output is correct
28 Correct 10 ms 2548 KB Output is correct
29 Correct 9 ms 2552 KB Output is correct
30 Correct 10 ms 2524 KB Output is correct
31 Correct 10 ms 2548 KB Output is correct
32 Correct 9 ms 2564 KB Output is correct
33 Correct 15 ms 2556 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 6 ms 2396 KB Output is correct
5 Correct 17 ms 2556 KB Output is correct
6 Correct 26 ms 2548 KB Output is correct
7 Correct 9 ms 2396 KB Output is correct
8 Correct 10 ms 2568 KB Output is correct
9 Correct 10 ms 2396 KB Output is correct
10 Correct 10 ms 2396 KB Output is correct
11 Correct 24 ms 2392 KB Output is correct
12 Correct 10 ms 2548 KB Output is correct
13 Correct 9 ms 2552 KB Output is correct
14 Correct 10 ms 2524 KB Output is correct
15 Correct 10 ms 2548 KB Output is correct
16 Correct 9 ms 2564 KB Output is correct
17 Correct 15 ms 2556 KB Output is correct
18 Correct 1 ms 2396 KB Output is correct
19 Correct 1 ms 2396 KB Output is correct
20 Correct 0 ms 2396 KB Output is correct
21 Correct 0 ms 2396 KB Output is correct
22 Correct 0 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 1 ms 2392 KB Output is correct
26 Correct 0 ms 2396 KB Output is correct
27 Correct 0 ms 2396 KB Output is correct
28 Correct 0 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 1 ms 2504 KB Output is correct
34 Correct 28 ms 2520 KB Output is correct
35 Correct 26 ms 2396 KB Output is correct
36 Correct 37 ms 2396 KB Output is correct
37 Correct 11 ms 2392 KB Output is correct
38 Correct 24 ms 2396 KB Output is correct
39 Correct 12 ms 2592 KB Output is correct
40 Correct 15 ms 2652 KB Output is correct
41 Correct 15 ms 2544 KB Output is correct
42 Correct 11 ms 2564 KB Output is correct
43 Correct 11 ms 2396 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 28 ms 2520 KB Output is correct
2 Correct 26 ms 2396 KB Output is correct
3 Correct 37 ms 2396 KB Output is correct
4 Correct 11 ms 2392 KB Output is correct
5 Correct 24 ms 2396 KB Output is correct
6 Correct 12 ms 2592 KB Output is correct
7 Correct 15 ms 2652 KB Output is correct
8 Correct 15 ms 2544 KB Output is correct
9 Correct 11 ms 2564 KB Output is correct
10 Correct 11 ms 2396 KB Output is correct
11 Correct 1 ms 2396 KB Output is correct
12 Correct 1 ms 2396 KB Output is correct
13 Correct 0 ms 2396 KB Output is correct
14 Correct 6 ms 2396 KB Output is correct
15 Correct 17 ms 2556 KB Output is correct
16 Correct 26 ms 2548 KB Output is correct
17 Correct 9 ms 2396 KB Output is correct
18 Correct 10 ms 2568 KB Output is correct
19 Correct 10 ms 2396 KB Output is correct
20 Correct 10 ms 2396 KB Output is correct
21 Correct 24 ms 2392 KB Output is correct
22 Correct 10 ms 2548 KB Output is correct
23 Correct 9 ms 2552 KB Output is correct
24 Correct 10 ms 2524 KB Output is correct
25 Correct 10 ms 2548 KB Output is correct
26 Correct 9 ms 2564 KB Output is correct
27 Correct 15 ms 2556 KB Output is correct
28 Correct 1 ms 2396 KB Output is correct
29 Correct 1 ms 2396 KB Output is correct
30 Correct 0 ms 2396 KB Output is correct
31 Correct 0 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 0 ms 2396 KB Output is correct
35 Correct 1 ms 2392 KB Output is correct
36 Correct 0 ms 2396 KB Output is correct
37 Correct 0 ms 2396 KB Output is correct
38 Correct 0 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 1 ms 2504 KB Output is correct
44 Execution timed out 1041 ms 2896 KB Time limit exceeded
45 Halted 0 ms 0 KB -