結果

問題 No.496 ワープクリスタル (給料日前編)
ユーザー playrollerplayroller
提出日時 2019-04-16 13:02:51
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,064 bytes
コンパイル時間 1,912 ms
コンパイル使用メモリ 172,168 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-22 07:00:24
合計ジャッジ時間 2,872 ms
ジャッジサーバーID
(参考情報)
judge9 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

#define rep(i,j,n) for(int i=j;i<n;++i)
#define all(i) i.begin(),i.end()
#define rall(i) i.rbegin(), i.rend()
#define INF 1e9
#define LINF 1e18
const int mod = 1e9 + 7;

typedef long long i64;
typedef pair<int, int> pi;

template <class T> using vt = vector<T>;
template <class T> using vvt = vector<vector<T>>;

i64 gcd(i64 n, i64 m) {return (m == 0? n : gcd(m, n % m));}
i64 lcd(i64 n, i64 m) {return (n / gcd(n, m) * m);}
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  int gx, gy, n, f;
  cin >> gx >> gy >> n >> f;
  vt<int> x(n), y(n), c(n);
  rep(i, 0, n) cin >> x[i] >> y[i] >> c[i];

  vvt<int> dp(300, vt<int>(300, INF));
  dp[0][0] = 0;
  rep(i, 0, gx + 1) {
    rep(j, 0, gy + 1) {
      rep(k, 0, n) {
        dp[i + x[k]][j + y[k]] = min(dp[i + x[k]][j + y[k]], dp[i][j] + c[k]);
      }
      dp[i + 1][j] = min(dp[i + 1][j], dp[i][j] + f);
      dp[i][j + 1] = min(dp[i][j + 1], dp[i][j] + f);
    }
  }
  cout << dp[gx][gy] << endl;
}
0