結果

問題 No.2408 Lakes and Fish
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2023-08-11 22:20:40
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 414 ms / 2,000 ms
コード長 320 bytes
コンパイル時間 443 ms
コンパイル使用メモリ 82,264 KB
実行使用メモリ 94,080 KB
最終ジャッジ日時 2024-11-18 16:50:26
合計ジャッジ時間 7,082 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m = map(int,input().split())
L = [-10**10]+list(map(int,input().split()))+[10**10]

FBW = [list(map(int,input().split())) for i in range(m)]

FBW.sort()

ans = 0

now = 0
for f,b,w in FBW:
    while now < n+2 and L[now] < f:
        now += 1
    
    dist = min(f-L[now-1],L[now]-f)
    ans += max(w-dist,b)
print(ans)
0