結果

問題 No.496 ワープクリスタル (給料日前編)
ユーザー oxyshoweroxyshower
提出日時 2019-12-01 20:00:11
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 994 bytes
コンパイル時間 1,666 ms
コンパイル使用メモリ 168,200 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2024-05-01 12:01:09
合計ジャッジ時間 2,578 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
7,568 KB
testcase_01 AC 3 ms
7,396 KB
testcase_02 AC 3 ms
7,552 KB
testcase_03 AC 4 ms
7,520 KB
testcase_04 AC 4 ms
7,560 KB
testcase_05 AC 4 ms
7,464 KB
testcase_06 WA -
testcase_07 AC 4 ms
7,400 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 4 ms
7,420 KB
testcase_11 AC 4 ms
7,564 KB
testcase_12 AC 4 ms
7,676 KB
testcase_13 AC 4 ms
7,412 KB
testcase_14 AC 5 ms
7,660 KB
testcase_15 AC 4 ms
7,492 KB
testcase_16 AC 4 ms
7,420 KB
testcase_17 AC 4 ms
7,528 KB
testcase_18 AC 4 ms
7,520 KB
testcase_19 AC 4 ms
7,556 KB
testcase_20 AC 5 ms
7,508 KB
testcase_21 AC 4 ms
7,584 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#ifdef LOCAL_DEBUG
  #include "LOCAL_DEBUG.hpp"
#endif
#define int long long
const int INF = 1LL << 60;

signed main(){

  int Gx, Gy, N, F; cin >> Gx >> Gy >> N >> F;
  static int dp[101][101][51];
  fill(dp[0][0], dp[100][100] + 50, INF);
  dp[0][0][0] = 0;
  for(int i = 0; i < N; i++){
    int x, y, c; cin >> x >> y >> c;
    for(int j = 0; j <= Gx; j++){
      for(int k = 0; k <= Gy; k++){
        dp[j][k][i+1] = min(dp[j][k][i+1], dp[j][k][i]);
        if(j + x <= Gx && k + y <= Gy){
          dp[j + x][k + y][i+1] = min(dp[j + x][k + y][i+1], dp[j][k][i] + c);
        }
      }
    }
    for(int j = 0; j <= Gx; j++){
      for(int k = 0; k <= Gy; k++){
        if(j + 1 <= Gx){
          dp[j + 1][k][i+1] = min(dp[j + 1][k][i+1], dp[j][k][i+1] + F);
        }
        if(k + 1 <= Gy){
          dp[j][k + 1][i+1] = min(dp[j][k + 1][i+1], dp[j][k][i+1] + F);
        }
      }
    }
  }
  cout << dp[Gx][Gy][N] << endl;

  return 0;
}
0