Submission #58587

#TimeUsernameProblemLanguageResultExecution timeMemory
58587andy627리조트 (KOI16_resort)C++17
100 / 100
4 ms836 KiB
#include <stdio.h> #include <algorithm> #define INF 999999999 using namespace std; int dp[111][44]; bool cant[111]; int main(){ int n,m; scanf("%d %d",&n,&m); for(int i=0;i<m;i++){ int num; scanf("%d",&num); cant[num]=1; } for(int i=0;i<=n;i++){ for(int j=0;j<=40;j++) dp[i][j]=INF; } dp[0][0]=0; for(int i=0;i<=n;i++){ for(int j=0;j<=40;j++){ dp[i+1][j]=min(dp[i+1][j],dp[i][j]+10); dp[i+3][j+1]=min(dp[i+3][j+1],dp[i][j]+25); dp[i+5][j+2]=min(dp[i+5][j+2],dp[i][j]+37); if(j>=3) dp[i+1][j-3]=min(dp[i+1][j-3],dp[i][j]); if(cant[i+1]) dp[i+1][j]=min(dp[i+1][j],dp[i][j]); } } int mn=INF; for(int i=0;i<=40;i++) mn=min(mn,dp[n][i]); printf("%d",mn*1000); return 0; }

Compilation message (stderr)

resort.cpp: In function 'int main()':
resort.cpp:12:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d",&n,&m);
     ~~~~~^~~~~~~~~~~~~~~
resort.cpp:15:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d",&num);
         ~~~~~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...