Submission #970842

# Submission time Handle Problem Language Result Execution time Memory
970842 2024-04-27T11:16:58 Z ibm2006 도장 모으기 (JOI14_stamps) C++17
0 / 100
47 ms 57120 KB
#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

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 time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 860 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 47 ms 57120 KB Output isn't correct
2 Halted 0 ms 0 KB -