結果
| 問題 | No.3597 Queen Score Attack 2 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-07-24 23:14:00 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 270 bytes |
| 記録 | |
| コンパイル時間 | 261 ms |
| コンパイル使用メモリ | 95,980 KB |
| 実行使用メモリ | 223,360 KB |
| 最終ジャッジ日時 | 2026-07-24 23:14:11 |
| 合計ジャッジ時間 | 9,940 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 4 WA * 14 |
ソースコード
H, W, x, y, N = map(int, input().split())
dp = [0] * 2
for nx, ny, c in [map(int, input().split()) for _ in range(N)]:
ndp = [dp[1] + c, max(dp)]
if x == nx or y == ny:
ndp[0] = max(ndp[0], dp[0] + c)
x = nx
y = ny
dp = ndp
print(max(dp))