답안 #1117332

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1117332 2024-11-23T10:27:42 Z KALARRY Rabbit Carrot (LMIO19_triusis) C++14
63 / 100
1000 ms 1696 KB
//chockolateman

#include<bits/stdc++.h>

using namespace std;

const int INF = 1e9;

int N,M,a[200005],dp[200005];

int main()
{
    scanf("%d%d",&N,&M);
    for(int i = 1 ; i <= N ; i++)
        scanf("%d",&a[i]);
    int ans = N;
    for(int i = 1 ; i <= N ; i++)
    {
        dp[i] = INF;
        for(int j = i-1 ; j >= 0 ; j--) //last not changed is j
        {
            long long max_reach = a[j] + (i - j)*M;
            if(max_reach >= a[i])
                dp[i] = min(dp[i],dp[j] + (i-1-j));
        }
        ans = min(ans,dp[i] + N-i);
    }
    printf("%d\n",ans);
    return 0;
}

Compilation message

triusis.cpp: In function 'int main()':
triusis.cpp:13:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |     scanf("%d%d",&N,&M);
      |     ~~~~~^~~~~~~~~~~~~~
triusis.cpp:15:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |         scanf("%d",&a[i]);
      |         ~~~~~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 504 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 592 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 1 ms 336 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 504 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 592 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 1 ms 336 KB Output is correct
17 Correct 1 ms 336 KB Output is correct
18 Correct 1 ms 336 KB Output is correct
19 Correct 1 ms 336 KB Output is correct
20 Correct 9 ms 480 KB Output is correct
21 Correct 14 ms 336 KB Output is correct
22 Correct 28 ms 504 KB Output is correct
23 Correct 13 ms 336 KB Output is correct
24 Correct 14 ms 336 KB Output is correct
25 Correct 13 ms 336 KB Output is correct
26 Correct 13 ms 336 KB Output is correct
27 Correct 14 ms 336 KB Output is correct
28 Correct 14 ms 336 KB Output is correct
29 Correct 13 ms 336 KB Output is correct
30 Correct 19 ms 432 KB Output is correct
31 Correct 14 ms 336 KB Output is correct
32 Correct 13 ms 336 KB Output is correct
33 Correct 13 ms 512 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 9 ms 480 KB Output is correct
5 Correct 14 ms 336 KB Output is correct
6 Correct 28 ms 504 KB Output is correct
7 Correct 13 ms 336 KB Output is correct
8 Correct 14 ms 336 KB Output is correct
9 Correct 13 ms 336 KB Output is correct
10 Correct 13 ms 336 KB Output is correct
11 Correct 14 ms 336 KB Output is correct
12 Correct 14 ms 336 KB Output is correct
13 Correct 13 ms 336 KB Output is correct
14 Correct 19 ms 432 KB Output is correct
15 Correct 14 ms 336 KB Output is correct
16 Correct 13 ms 336 KB Output is correct
17 Correct 13 ms 512 KB Output is correct
18 Correct 1 ms 336 KB Output is correct
19 Correct 1 ms 504 KB Output is correct
20 Correct 1 ms 336 KB Output is correct
21 Correct 1 ms 592 KB Output is correct
22 Correct 1 ms 336 KB Output is correct
23 Correct 1 ms 336 KB Output is correct
24 Correct 1 ms 336 KB Output is correct
25 Correct 1 ms 336 KB Output is correct
26 Correct 1 ms 336 KB Output is correct
27 Correct 1 ms 336 KB Output is correct
28 Correct 1 ms 336 KB Output is correct
29 Correct 1 ms 336 KB Output is correct
30 Correct 1 ms 336 KB Output is correct
31 Correct 1 ms 336 KB Output is correct
32 Correct 1 ms 336 KB Output is correct
33 Correct 1 ms 336 KB Output is correct
34 Correct 29 ms 536 KB Output is correct
35 Correct 29 ms 536 KB Output is correct
36 Correct 28 ms 532 KB Output is correct
37 Correct 14 ms 336 KB Output is correct
38 Correct 15 ms 536 KB Output is correct
39 Correct 14 ms 336 KB Output is correct
40 Correct 13 ms 504 KB Output is correct
41 Correct 14 ms 340 KB Output is correct
42 Correct 13 ms 336 KB Output is correct
43 Correct 14 ms 336 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 29 ms 536 KB Output is correct
2 Correct 29 ms 536 KB Output is correct
3 Correct 28 ms 532 KB Output is correct
4 Correct 14 ms 336 KB Output is correct
5 Correct 15 ms 536 KB Output is correct
6 Correct 14 ms 336 KB Output is correct
7 Correct 13 ms 504 KB Output is correct
8 Correct 14 ms 340 KB Output is correct
9 Correct 13 ms 336 KB Output is correct
10 Correct 14 ms 336 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 9 ms 480 KB Output is correct
15 Correct 14 ms 336 KB Output is correct
16 Correct 28 ms 504 KB Output is correct
17 Correct 13 ms 336 KB Output is correct
18 Correct 14 ms 336 KB Output is correct
19 Correct 13 ms 336 KB Output is correct
20 Correct 13 ms 336 KB Output is correct
21 Correct 14 ms 336 KB Output is correct
22 Correct 14 ms 336 KB Output is correct
23 Correct 13 ms 336 KB Output is correct
24 Correct 19 ms 432 KB Output is correct
25 Correct 14 ms 336 KB Output is correct
26 Correct 13 ms 336 KB Output is correct
27 Correct 13 ms 512 KB Output is correct
28 Correct 1 ms 336 KB Output is correct
29 Correct 1 ms 504 KB Output is correct
30 Correct 1 ms 336 KB Output is correct
31 Correct 1 ms 592 KB Output is correct
32 Correct 1 ms 336 KB Output is correct
33 Correct 1 ms 336 KB Output is correct
34 Correct 1 ms 336 KB Output is correct
35 Correct 1 ms 336 KB Output is correct
36 Correct 1 ms 336 KB Output is correct
37 Correct 1 ms 336 KB Output is correct
38 Correct 1 ms 336 KB Output is correct
39 Correct 1 ms 336 KB Output is correct
40 Correct 1 ms 336 KB Output is correct
41 Correct 1 ms 336 KB Output is correct
42 Correct 1 ms 336 KB Output is correct
43 Correct 1 ms 336 KB Output is correct
44 Execution timed out 1060 ms 1696 KB Time limit exceeded
45 Halted 0 ms 0 KB -