Submission #299415

# Submission time Handle Problem Language Result Execution time Memory
299415 2020-09-14T21:17:25 Z Bruteforceman Rabbit Carrot (LMIO19_triusis) C++11
63 / 100
1000 ms 1788 KB
#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
const int inf = 1e8;
int a[maxn], dp[maxn];

int main() {
  int n, k;
  scanf("%d %d", &n, &k);
  for(int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  int ans = 0;
  dp[0] = 0; 
  for(int i = 1; i <= n; i++) {
    dp[i] = -inf;
    for(int j = 0; j < i; j++) {
      if(a[i] - a[j] <= 1LL * k * (i - j)) {
        dp[i] = max(dp[i], 1 + dp[j]);
      }
    }
    ans = max(ans, dp[i]);
  }
  cout << n - ans << endl;
  return 0;
}

Compilation message

triusis.cpp: In function 'int main()':
triusis.cpp:9:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    9 |   scanf("%d %d", &n, &k);
      |   ~~~~~^~~~~~~~~~~~~~~~~
triusis.cpp:11:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   11 |     scanf("%d", &a[i]);
      |     ~~~~~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 256 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 1 ms 256 KB Output is correct
12 Correct 1 ms 256 KB Output is correct
13 Correct 1 ms 384 KB Output is correct
14 Correct 1 ms 256 KB Output is correct
15 Correct 1 ms 384 KB Output is correct
16 Correct 1 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 512 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 14 ms 384 KB Output is correct
5 Correct 18 ms 384 KB Output is correct
6 Correct 44 ms 384 KB Output is correct
7 Correct 18 ms 384 KB Output is correct
8 Correct 18 ms 384 KB Output is correct
9 Correct 20 ms 384 KB Output is correct
10 Correct 18 ms 384 KB Output is correct
11 Correct 32 ms 384 KB Output is correct
12 Correct 18 ms 384 KB Output is correct
13 Correct 18 ms 384 KB Output is correct
14 Correct 18 ms 384 KB Output is correct
15 Correct 16 ms 384 KB Output is correct
16 Correct 18 ms 384 KB Output is correct
17 Correct 18 ms 384 KB Output is correct
18 Correct 1 ms 384 KB Output is correct
19 Correct 1 ms 384 KB Output is correct
20 Correct 1 ms 256 KB Output is correct
21 Correct 1 ms 384 KB Output is correct
22 Correct 1 ms 256 KB Output is correct
23 Correct 1 ms 384 KB Output is correct
24 Correct 1 ms 384 KB Output is correct
25 Correct 1 ms 384 KB Output is correct
26 Correct 1 ms 384 KB Output is correct
27 Correct 1 ms 384 KB Output is correct
28 Correct 1 ms 256 KB Output is correct
29 Correct 1 ms 256 KB Output is correct
30 Correct 1 ms 384 KB Output is correct
31 Correct 1 ms 256 KB Output is correct
32 Correct 1 ms 384 KB Output is correct
33 Correct 1 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 46 ms 384 KB Output is correct
2 Correct 45 ms 512 KB Output is correct
3 Correct 46 ms 384 KB Output is correct
4 Correct 18 ms 384 KB Output is correct
5 Correct 31 ms 384 KB Output is correct
6 Correct 20 ms 384 KB Output is correct
7 Correct 15 ms 384 KB Output is correct
8 Correct 18 ms 384 KB Output is correct
9 Correct 18 ms 384 KB Output is correct
10 Correct 18 ms 384 KB Output is correct
11 Correct 1 ms 384 KB Output is correct
12 Correct 1 ms 512 KB Output is correct
13 Correct 1 ms 384 KB Output is correct
14 Correct 14 ms 384 KB Output is correct
15 Correct 18 ms 384 KB Output is correct
16 Correct 44 ms 384 KB Output is correct
17 Correct 18 ms 384 KB Output is correct
18 Correct 18 ms 384 KB Output is correct
19 Correct 20 ms 384 KB Output is correct
20 Correct 18 ms 384 KB Output is correct
21 Correct 32 ms 384 KB Output is correct
22 Correct 18 ms 384 KB Output is correct
23 Correct 18 ms 384 KB Output is correct
24 Correct 18 ms 384 KB Output is correct
25 Correct 16 ms 384 KB Output is correct
26 Correct 18 ms 384 KB Output is correct
27 Correct 18 ms 384 KB Output is correct
28 Correct 1 ms 384 KB Output is correct
29 Correct 1 ms 384 KB Output is correct
30 Correct 1 ms 256 KB Output is correct
31 Correct 1 ms 384 KB Output is correct
32 Correct 1 ms 256 KB Output is correct
33 Correct 1 ms 384 KB Output is correct
34 Correct 1 ms 384 KB Output is correct
35 Correct 1 ms 384 KB Output is correct
36 Correct 1 ms 384 KB Output is correct
37 Correct 1 ms 384 KB Output is correct
38 Correct 1 ms 256 KB Output is correct
39 Correct 1 ms 256 KB Output is correct
40 Correct 1 ms 384 KB Output is correct
41 Correct 1 ms 256 KB Output is correct
42 Correct 1 ms 384 KB Output is correct
43 Correct 1 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 46 ms 384 KB Output is correct
2 Correct 45 ms 512 KB Output is correct
3 Correct 46 ms 384 KB Output is correct
4 Correct 18 ms 384 KB Output is correct
5 Correct 31 ms 384 KB Output is correct
6 Correct 20 ms 384 KB Output is correct
7 Correct 15 ms 384 KB Output is correct
8 Correct 18 ms 384 KB Output is correct
9 Correct 18 ms 384 KB Output is correct
10 Correct 18 ms 384 KB Output is correct
11 Correct 1 ms 384 KB Output is correct
12 Correct 1 ms 512 KB Output is correct
13 Correct 1 ms 384 KB Output is correct
14 Correct 14 ms 384 KB Output is correct
15 Correct 18 ms 384 KB Output is correct
16 Correct 44 ms 384 KB Output is correct
17 Correct 18 ms 384 KB Output is correct
18 Correct 18 ms 384 KB Output is correct
19 Correct 20 ms 384 KB Output is correct
20 Correct 18 ms 384 KB Output is correct
21 Correct 32 ms 384 KB Output is correct
22 Correct 18 ms 384 KB Output is correct
23 Correct 18 ms 384 KB Output is correct
24 Correct 18 ms 384 KB Output is correct
25 Correct 16 ms 384 KB Output is correct
26 Correct 18 ms 384 KB Output is correct
27 Correct 18 ms 384 KB Output is correct
28 Execution timed out 1051 ms 1788 KB Time limit exceeded
29 Halted 0 ms 0 KB -