제출 #76855

#제출 시각아이디문제언어결과실행 시간메모리
76855VardanyanStove (JOI18_stove)C++14
50 / 100
214 ms83244 KiB
#include <bits/stdc++.h> using namespace std; const int N = 5007; long long a[N]; long long dp[N][N]; int main(){ int n,k; scanf("%d%d",&n,&k); for(int i = 1;i<=n;i++){ scanf("%lld",&a[i]); for(int j = 0;j<=k;j++) dp[i][j] = 100000000000000005; } for(int kk = 1;kk<=k;kk++){ dp[1][kk] = 1; for(int i = 2;i<=n;i++){ dp[i][kk] = min(dp[i][kk],dp[i-1][kk]+((a[i]+1)-(a[i-1]+1))); dp[i][kk+1] = min(dp[i][kk+1],dp[i-1][kk]+1); } } printf("%lld\n",dp[n][k]); return 0; }

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

stove.cpp: In function 'int main()':
stove.cpp:8:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d",&n,&k);
     ~~~~~^~~~~~~~~~~~~~
stove.cpp:10:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
             scanf("%lld",&a[i]);
             ~~~~~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...