Submission #199925

# Submission time Handle Problem Language Result Execution time Memory
199925 2020-02-04T06:10:35 Z SamAnd Rabbit Carrot (LMIO19_triusis) C++17
63 / 100
1000 ms 1764 KB
#include <bits/stdc++.h>
using namespace std;
const int N = 500005;

int n, m;
int a[N];

int dp[N];
int main()
{
    scanf("%d%d", &n, &m);
    for (int i = 1; i <= n; ++i)
        scanf("%d", &a[i]);
    for (int i = 1; i <= n; ++i)
    {
        dp[i] = N;
        for (int j = 0; j < i; ++j)
        {
            if (a[j] + (i - j) * 1LL * m >= a[i])
                dp[i] = min(dp[i], dp[j] + (i - j - 1));
        }
    }
    int ans = n;
    for (int i = 1; i <= n; ++i)
        ans = min(ans, dp[i] + (n - i));
    printf("%d\n", ans);
    return 0;
}

Compilation message

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