제출 #199925

#제출 시각아이디문제언어결과실행 시간메모리
199925SamAndRabbit Carrot (LMIO19_triusis)C++17
63 / 100
1074 ms1764 KiB
#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;
}

컴파일 시 표준 에러 (stderr) 메시지

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...