結果

問題 No.2408 Lakes and Fish
ユーザー ニックネーム
提出日時 2023-08-11 21:31:26
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 623 ms / 2,000 ms
コード長 320 bytes
コンパイル時間 284 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 21,956 KB
最終ジャッジ日時 2024-11-18 15:29:19
合計ジャッジ時間 9,753 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

from bisect import bisect_left
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())
    i = bisect_left(l,f)
    c = 0 if i<n and l[i]==f else 10**9
    if i>0: c = min(c,f-l[i-1])
    if i<n: c = min(c,l[i]-f)
    ans += max(b,w-c)
print(ans)
0