답안 #42481

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
42481 2018-02-27T16:24:24 Z dqhungdl 도장 모으기 (JOI14_stamps) C++14
100 / 100
115 ms 35952 KB
#include <bits/stdc++.h>
using namespace std;

int n,T,f[3005][3005];

int main()
{
    ios_base::sync_with_stdio(false);
    //freopen("TEST.INP","r",stdin);
    cin>>n>>T;
    for(int i=0;i<=n;i++)
        for(int j=0;j<=n+1;j++)
            f[i][j]=1e9;
    f[0][0]=T;
    int U,V,D,E;
    for(int i=0;i<n;i++)
    {
        cin>>U>>V>>D>>E;
        for(int j=0;j<=n;j++)
        {
            f[i+1][j]=min(f[i+1][j],f[i][j]+U+V+T*(j*2+1));
            f[i+1][j+1]=min(f[i+1][j+1],f[i][j]+V+D+T*(j*2+1));
            if(j>0)
            {
                f[i+1][j-1]=min(f[i+1][j-1],f[i][j]+U+E+T*(j*2+1));
                f[i+1][j]=min(f[i+1][j],f[i][j]+D+E+T*(j*2+1));
            }
        }
        for(int j=1;j<=n;j++)
            f[i+1][j]=min(f[i+1][j],f[i+1][j-1]+V+D);
    }
    cout<<f[n][0];
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 380 KB Output is correct
2 Correct 1 ms 380 KB Output is correct
3 Correct 2 ms 424 KB Output is correct
4 Correct 2 ms 440 KB Output is correct
5 Correct 2 ms 476 KB Output is correct
6 Correct 1 ms 476 KB Output is correct
7 Correct 2 ms 664 KB Output is correct
8 Correct 2 ms 664 KB Output is correct
9 Correct 2 ms 664 KB Output is correct
10 Correct 2 ms 664 KB Output is correct
11 Correct 2 ms 664 KB Output is correct
12 Correct 2 ms 664 KB Output is correct
13 Correct 2 ms 664 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1004 KB Output is correct
2 Correct 2 ms 1004 KB Output is correct
3 Correct 2 ms 1004 KB Output is correct
4 Correct 2 ms 1004 KB Output is correct
5 Correct 1 ms 1004 KB Output is correct
6 Correct 2 ms 1004 KB Output is correct
7 Correct 2 ms 1004 KB Output is correct
8 Correct 2 ms 1004 KB Output is correct
9 Correct 2 ms 1004 KB Output is correct
10 Correct 2 ms 1004 KB Output is correct
11 Correct 2 ms 1004 KB Output is correct
12 Correct 2 ms 1004 KB Output is correct
13 Correct 2 ms 1004 KB Output is correct
14 Correct 2 ms 1004 KB Output is correct
15 Correct 2 ms 1004 KB Output is correct
16 Correct 2 ms 1004 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 113 ms 35820 KB Output is correct
2 Correct 2 ms 35820 KB Output is correct
3 Correct 110 ms 35924 KB Output is correct
4 Correct 89 ms 35924 KB Output is correct
5 Correct 70 ms 35924 KB Output is correct
6 Correct 35 ms 35924 KB Output is correct
7 Correct 21 ms 35924 KB Output is correct
8 Correct 107 ms 35952 KB Output is correct
9 Correct 109 ms 35952 KB Output is correct
10 Correct 112 ms 35952 KB Output is correct
11 Correct 107 ms 35952 KB Output is correct
12 Correct 110 ms 35952 KB Output is correct
13 Correct 115 ms 35952 KB Output is correct
14 Correct 113 ms 35952 KB Output is correct
15 Correct 114 ms 35952 KB Output is correct
16 Correct 112 ms 35952 KB Output is correct
17 Correct 112 ms 35952 KB Output is correct