Submission #970842

#TimeUsernameProblemLanguageResultExecution timeMemory
970842ibm2006도장 모으기 (JOI14_stamps)C++17
0 / 100
47 ms57120 KiB
#include<bits/stdc++.h> using namespace std; typedef long long int ll; const ll inf=1e18; ll n,i,j,k,l,r,x,y,z,w,s,t,a[110000],cost[3300][3300],dp[3300],u[3300],v[3300],d[3300],e[3300]; int main() { scanf("%lld %lld",&n,&k); for(i=1;i<=n;i++) { scanf("%lld %lld %lld %lld",&x,&y,&z,&w); u[i]=x; v[i]=y; d[i]=z; e[i]=w; } dp[0]=0; for(i=1;i<=n+1;i++) dp[i]=inf; for(i=1;i<=n;i++) { for(j=i;j<=n;j++) { cost[i][j]=cost[i][j-1]+min(u[j]+v[j],e[j]+d[j]); } } for(i=1;i<=n;i++) { dp[i]=min(dp[i],dp[i-1]+k+u[i]+v[i]); for(j=i-1;j>=0;j--) { dp[i]=min(dp[i],dp[j]+cost[j+2][i-1]+u[i]+e[i]+d[j+1]+v[j+1]+k+k*(i-j)); } } printf("%lld",dp[n]+k*2); }

Compilation message (stderr)

stamps.cpp: In function 'int main()':
stamps.cpp:18:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   18 |     for(i=1;i<=n+1;i++)
      |     ^~~
stamps.cpp:20:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   20 |         for(i=1;i<=n;i++)
      |         ^~~
stamps.cpp:8:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |     scanf("%lld %lld",&n,&k);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~
stamps.cpp:11:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |         scanf("%lld %lld %lld %lld",&x,&y,&z,&w);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...