結果
| 問題 |
No.496 ワープクリスタル (給料日前編)
|
| コンテスト | |
| ユーザー |
maspy
|
| 提出日時 | 2020-02-26 12:40:47 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 522 ms / 2,000 ms |
| コード長 | 625 bytes |
| コンパイル時間 | 86 ms |
| コンパイル使用メモリ | 12,416 KB |
| 実行使用メモリ | 44,608 KB |
| 最終ジャッジ日時 | 2024-10-13 15:17:07 |
| 合計ジャッジ時間 | 17,145 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 23 |
ソースコード
#!/usr/bin/env python3
# %%
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
# %%
import numpy as np
# %%
Gx, Gy, N, F = map(int, readline().split())
m = map(int, read().split())
XYC = tuple(zip(m, m, m))
# %%
INF = 10 ** 16
dp = np.full((Gx + 1, Gy + 1), INF, np.int64)
dp[0, 0] = 0
# %%
for x, y, c in XYC:
np.minimum(
dp[x: Gx + 1, y: Gy + 1], dp[0: Gx + 1 - x, 0: Gy + 1 - y] + c,
out=dp[x:Gx + 1, y:Gy + 1])
# %%
dp += F * (np.arange(Gx + 1)[::-1][:, None] + np.arange(Gy + 1)[::-1][None, :])
answer = dp.min()
print(answer)
maspy