結果
| 問題 | No.496 ワープクリスタル (給料日前編) |
| コンテスト | |
| ユーザー |
nenuon
|
| 提出日時 | 2017-06-23 17:48:33 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,147 bytes |
| 記録 | |
| コンパイル時間 | 899 ms |
| コンパイル使用メモリ | 91,928 KB |
| 実行使用メモリ | 15,604 KB |
| 最終ジャッジ日時 | 2024-10-03 04:13:05 |
| 合計ジャッジ時間 | 4,189 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 3 |
| other | AC * 11 WA * 12 |
ソースコード
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
int main(){
int gy,gx,n,f;
cin>>gx>>gy>>n>>f;
int x[n],y[n],c[n];
FOR(i,0,n){
cin >> x[i] >> y[i] >> c[i];
}
int dp[301][gy+1][gx+1];
FOR(i,0,301){
FOR(j,0,gy+1){
FOR(k,0,gx+1){
dp[i][j][k] = 9999999;
}
}
}
dp[0][0][0] = 0;
FOR(i,0,300){
FOR(j,0,gy+1){
FOR(k,0,gx+1){
if(dp[i][j][k] == 9999999) continue;
dp[i+1][j][k] = dp[i][j][k];
if(j+1 <= gy) dp[i+1][j+1][k] = min(dp[i+1][j+1][k], dp[i][j][k] + f);
if(k+1 <= gx) dp[i+1][j][k+1] = min(dp[i+1][j][k+1], dp[i][j][k] + f);
FOR(l,0,n){
int nx = k + x[l], ny = j + y[l];
if(nx > gx || ny > gy) continue;
dp[i+1][ny][nx] = min(dp[i+1][ny][nx], dp[i][j][k] + c[l]);
}
}
}
}
cout << dp[300][gy][gx] << endl;
return 0;
}
nenuon