結果

問題 No.2408 Lakes and Fish
コンテスト
ユーザー lloyz
提出日時 2023-08-17 10:26:55
言語 PyPy3
(8.0.0 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 104 ms / 2,000 ms
+ 942µs
コード長 390 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 69 ms
コンパイル使用メモリ 80,084 KB
実行使用メモリ 97,160 KB
最終ジャッジ日時 2026-09-30 05:28:56
合計ジャッジ時間 5,180 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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)
0