結果

問題 No.2408 Lakes and Fish
コンテスト
ユーザー Mottchan
提出日時 2023-08-12 08:59:15
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 145 ms / 2,000 ms
コード長 478 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 294 ms
コンパイル使用メモリ 85,248 KB
実行使用メモリ 96,256 KB
最終ジャッジ日時 2026-05-13 16:18:55
合計ジャッジ時間 4,205 ms
ジャッジサーバーID
(参考情報)
judge1_1 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

from collections import defaultdict, deque, Counter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right
from math import gcd

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)
    if idx == 0:
        ans+=max(w-(l[idx]-f), b)
    elif idx < n:
        ans+=max(w-(f-l[idx-1]),w-(l[idx]-f), b)
    else:
        ans+=max(w-(f-l[-1]),b)
print(ans)
0