結果
問題 | No.496 ワープクリスタル (給料日前編) |
ユーザー | shinwisteria |
提出日時 | 2017-03-24 23:42:40 |
言語 | Java19 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 726 bytes |
コンパイル時間 | 5,729 ms |
コンパイル使用メモリ | 74,092 KB |
実行使用メモリ | 57,956 KB |
最終ジャッジ日時 | 2023-09-20 05:33:09 |
合計ジャッジ時間 | 11,617 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge15 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | AC | 129 ms
55,712 KB |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | AC | 163 ms
56,248 KB |
testcase_07 | AC | 128 ms
55,624 KB |
testcase_08 | WA | - |
testcase_09 | AC | 206 ms
55,692 KB |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
ソースコード
import java.util.Scanner; public class WarpCristal { public static void main(String[] args) { Scanner s = new Scanner(System.in); int Gx = s.nextInt(),Gy = s.nextInt(),N = s.nextInt(),F = s.nextInt(); int[][] cost = new int[Gx+1][Gy+1]; int[][] d = new int[Gx+1][Gy+1]; for(int i = 0;i < N;i++){ d[s.nextInt()][s.nextInt()] = s.nextInt(); } s.close(); for(int i = 0;i <= Gx;i++){ for(int j = 0;j <= Gy;j++){ cost[i][j] = (i+j)*F; for(int x = 0;x <= i;x++){ for(int y = 0;y <= j;y++){ if(d[x][y] != 0 && cost[i][j] > cost[i-x][j-y] + d[x][y]){ cost[i][j] = cost[i-x][j-y] + d[x][y]; d[x][y] = 0; } } } } } System.out.println(cost[Gx][Gy]); } }