結果

問題 No.496 ワープクリスタル (給料日前編)
ユーザー H3PO4H3PO4
提出日時 2020-09-01 09:15:14
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 554 ms / 2,000 ms
コード長 344 bytes
コンパイル時間 342 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 44,564 KB
最終ジャッジ日時 2024-04-28 22:36:19
合計ジャッジ時間 17,312 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 525 ms
44,056 KB
testcase_01 AC 521 ms
44,056 KB
testcase_02 AC 554 ms
44,060 KB
testcase_03 AC 517 ms
44,184 KB
testcase_04 AC 523 ms
44,320 KB
testcase_05 AC 522 ms
44,192 KB
testcase_06 AC 523 ms
44,316 KB
testcase_07 AC 520 ms
44,184 KB
testcase_08 AC 522 ms
43,936 KB
testcase_09 AC 535 ms
44,060 KB
testcase_10 AC 526 ms
44,312 KB
testcase_11 AC 521 ms
44,564 KB
testcase_12 AC 527 ms
44,440 KB
testcase_13 AC 523 ms
44,564 KB
testcase_14 AC 530 ms
44,312 KB
testcase_15 AC 531 ms
44,312 KB
testcase_16 AC 519 ms
44,064 KB
testcase_17 AC 522 ms
44,436 KB
testcase_18 AC 526 ms
44,064 KB
testcase_19 AC 526 ms
44,368 KB
testcase_20 AC 520 ms
44,444 KB
testcase_21 AC 522 ms
44,060 KB
testcase_22 AC 526 ms
44,444 KB
testcase_23 AC 522 ms
44,052 KB
testcase_24 AC 528 ms
44,448 KB
testcase_25 AC 523 ms
44,448 KB
testcase_26 AC 525 ms
44,052 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np

Gx, Gy, N, F = map(int, input().split())

dp = np.repeat(np.arange(Gx + 1)[None, :], Gy + 1, axis=0) \
     + np.repeat(np.arange(Gy + 1)[:, None], Gx + 1, axis=1)
dp *= F

for _ in range(N):
    X, Y, C = map(int, input().split())
    dp[Y:, X:] = np.minimum(dp[Y:, X:], dp[:Gy + 1 - Y, :Gx + 1 - X] + C)
print(dp[-1, -1])
0