結果
| 問題 | No.2408 Lakes and Fish |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-08-11 21:53:14 |
| 言語 | PyPy3 (7.3.23 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 146 ms / 2,000 ms |
| + 165µs | |
| コード長 | 462 bytes |
| 記録 | |
| コンパイル時間 | 61 ms |
| コンパイル使用メモリ | 82,056 KB |
| 実行使用メモリ | 99,828 KB |
| 最終ジャッジ日時 | 2026-09-25 22:51:04 |
| 合計ジャッジ時間 | 5,975 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 19 |
ソースコード
import bisect
N, M = map(int, input().split())
L = list(map(int, input().split()))
FBW = [list(map(int, input().split())) for _ in range(M)]
ans = 0
for f, b, w in FBW:
pos = bisect.bisect_left(L, f)
if pos<N:
if L[pos]==f:
ans += w
else:
c = L[pos]-f
if pos>0:
c = min(c, f-L[pos-1])
ans += max(b, w-c)
else:
c = f-L[pos-1]
ans += max(b, w-c)
print(ans)