結果
| 問題 |
No.2408 Lakes and Fish
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-08-17 10:26:55 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 152 ms / 2,000 ms |
| コード長 | 390 bytes |
| コンパイル時間 | 300 ms |
| コンパイル使用メモリ | 82,004 KB |
| 実行使用メモリ | 89,964 KB |
| 最終ジャッジ日時 | 2024-11-26 06:27:51 |
| 合計ジャッジ時間 | 4,921 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 19 |
ソースコード
from bisect import bisect_left
import sys
input = sys.stdin.readline
n, m = map(int, input().split())
L = list(map(int, input().split()))
ans = 0
for _ in range(m):
f, b, w = map(int, input().split())
idx = bisect_left(L, f)
res = b
if idx < n:
res = max(res, w - (L[idx] - f))
if idx > 0:
res = max(res, w - (f - L[idx - 1]))
ans += res
print(ans)