Submission #56924

#TimeUsernameProblemLanguageResultExecution timeMemory
56924red1108리조트 (KOI16_resort)C++17
100 / 100
4 ms1160 KiB
#include <stdio.h> #include <utility> #include <algorithm> using namespace std; int dp[110][50],mindp[110]; bool go[110]; int n, m,ans; void f(int day,int c,int money) { if(day>n) { if(ans==0||ans>money) ans=money; return ; } if(dp[day][c]!=0&&dp[day][c]<=money) return ; if(dp[day][mindp[day]]!=0&&(dp[day][mindp[day]]<=money&&mindp[day]>c)) return ; if(dp[day][c]==0||dp[day][c]>money){ dp[day][c]=money; if(dp[day][mindp[day]]==0||dp[day][mindp[day]]>money||(dp[day][mindp[day]]==money&&mindp[day]<c)) mindp[day]=c; } if(go[day]==0) f(day+1,c,money); else { f(day+5,c+2,money+37000); f(day+3,c+1,money+25000); f(day+1,c,money+10000); if(c>=3){f(day+1,c-3,money);} } } int main() { int i; scanf("%d %d",&n,&m); fill(go,go+n+1,1); fill(mindp,mindp+n+1,0); for(i=1;i<=m;i++) { int a; scanf("%d", &a); go[a]=0; } f(1,0,0); printf("%d", ans); }

Compilation message (stderr)

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