Submission #61743

#TimeUsernameProblemLanguageResultExecution timeMemory
61743ansol4328리조트 (KOI16_resort)C++98
100 / 100
4 ms964 KiB
#include<stdio.h> #include<algorithm> using namespace std; int n, m, d[102]; int dp[102][50]; bool not_going[102]; int main() { int out=1e9; scanf("%d %d",&n,&m); for(int i=0 ; i<m ; i++) { scanf("%d",&d[i]); not_going[d[i]]=true; } for(int i=0 ; i<=n ; i++) for(int j=0 ; j<=45 ; j++) dp[i][j]=1e9; dp[0][0]=0; for(int i=1 ; i<=n ; i++) { for(int j=0 ; j<=45 ; j++) { dp[i][j]=min(dp[i][j],dp[i-1][j]+10000); if(i>=3 && j>=1) dp[i][j]=min(dp[i][j],dp[i-3][j-1]+25000); if(i>=5 && j>=2) dp[i][j]=min(dp[i][j],dp[i-5][j-2]+37000); if(j<=27) dp[i][j]=min(dp[i][j],dp[i-1][j+3]); if(not_going[i]) { dp[i][j]=min(dp[i][j],dp[i-1][j]); } } } for(int i=0 ; i<=45 ; i++) out=min(out,dp[n][i]); printf("%d",out); return 0; }

Compilation message (stderr)

resort.cpp: In function 'int main()':
resort.cpp:13: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:16:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d",&d[i]);
         ~~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...