結果
問題 | No.496 ワープクリスタル (給料日前編) |
ユーザー | shinwisteria |
提出日時 | 2017-03-24 23:38:21 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 706 bytes |
コンパイル時間 | 4,375 ms |
コンパイル使用メモリ | 74,660 KB |
実行使用メモリ | 56,112 KB |
最終ジャッジ日時 | 2023-09-20 05:11:39 |
合計ジャッジ時間 | 10,043 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 128 ms
55,716 KB |
testcase_01 | AC | 126 ms
55,644 KB |
testcase_02 | AC | 127 ms
55,640 KB |
testcase_03 | AC | 126 ms
55,360 KB |
testcase_04 | WA | - |
testcase_05 | AC | 128 ms
55,732 KB |
testcase_06 | AC | 161 ms
55,492 KB |
testcase_07 | AC | 127 ms
55,644 KB |
testcase_08 | AC | 210 ms
55,424 KB |
testcase_09 | AC | 207 ms
55,760 KB |
testcase_10 | AC | 147 ms
55,544 KB |
testcase_11 | AC | 144 ms
55,532 KB |
testcase_12 | AC | 161 ms
55,360 KB |
testcase_13 | AC | 154 ms
55,780 KB |
testcase_14 | AC | 156 ms
55,980 KB |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | AC | 168 ms
55,496 KB |
testcase_19 | WA | - |
testcase_20 | AC | 160 ms
55,552 KB |
testcase_21 | AC | 147 ms
55,368 KB |
testcase_22 | WA | - |
testcase_23 | AC | 211 ms
55,468 KB |
testcase_24 | AC | 208 ms
53,688 KB |
testcase_25 | AC | 208 ms
55,464 KB |
testcase_26 | AC | 210 ms
55,644 KB |
ソースコード
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]; } } } } } System.out.println(cost[Gx][Gy]); } }