結果

問題 No.496 ワープクリスタル (給料日前編)
ユーザー confconf
提出日時 2017-03-24 22:40:14
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 646 bytes
コンパイル時間 566 ms
コンパイル使用メモリ 67,468 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-20 01:42:57
合計ジャッジ時間 1,577 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 WA -
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 3 ms
4,380 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 2 ms
4,384 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 1 ms
4,376 KB
testcase_19 WA -
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 1 ms
4,376 KB
testcase_22 WA -
testcase_23 AC 2 ms
4,380 KB
testcase_24 AC 2 ms
4,380 KB
testcase_25 AC 2 ms
4,376 KB
testcase_26 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
using namespace std;

int main(){
    int Gx,Gy,N,F;
    cin>>Gx>>Gy>>N>>F;
    int DP[Gx+1][Gy+1];
    fill(DP[0],DP[Gx+1],1000000);
    DP[0][0]=0;
    for(int i=0;i<N;i++){
        int x,y,c;
        cin>>x>>y>>c;
        for(int Y=0;Y+y<=Gy;Y++){
            for(int X=0;X+x<=Gx;X++){
                DP[X+x][Y+y]=min(DP[X+x][Y+y],DP[X][Y]+c);
            }
        }
    }
    for(int y=0;y<=Gy;y++){
        for(int x=0;x<=Gx;x++){
            if(x)DP[x][y]=min(DP[x][y],DP[x-1][y]+F);
            if(y)DP[x][y]=min(DP[x][y],DP[x][y-1]+F);
        }
    }
    cout<<DP[Gx][Gy]<<endl;
    return 0;
}
0