結果
| 問題 | No.496 ワープクリスタル (給料日前編) |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-12-02 14:11:41 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 782 bytes |
| 記録 | |
| コンパイル時間 | 1,111 ms |
| コンパイル使用メモリ | 158,688 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-28 03:36:07 |
| 合計ジャッジ時間 | 3,243 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 11 WA * 3 RE * 9 |
ソースコード
#include "bits/stdc++.h"
using namespace std;
#define print(x) cout<<x<<endl;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a) for(int i=0;i<a;i++)
#define printall(n,array) for(int i=0;i<n;i++){cout<<array[i]<<" ";}cout<<endl;
typedef long long ll;
typedef pair<int, int> PI;
typedef pair<int, PI> V;
typedef vector<int> VE;
const ll mod = 1000000007; //10^9+7
int dp[102][102];
int main(){
int X,Y,n,f;
cin>>X>>Y>>n>>f;
int x[52],y[52],c[52];
REP(i,n){
cin>>x[i]>>y[i]>>c[i];
}
REP(i,X+1)REP(j,Y+1){
dp[i][j]=(i+j)*f;
}
REP(k,n){
if(c[k]>(x[k]+y[k])*f)continue;
REP(i,X+1)REP(j,Y+1){
dp[i+x[k]][j+y[k]]=min(dp[i+x[k]][j+y[k]],dp[i][j]+c[k]);
//print(i+x[i]<<" "<<j+y[i]<<" "<<dp[i+x[i]][j+y[i]])
}
}
print(dp[X][Y]);
}