結果
| 問題 | No.2408 Lakes and Fish | 
| コンテスト | |
| ユーザー |  ikoma | 
| 提出日時 | 2023-08-11 21:55:53 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 194 ms / 2,000 ms | 
| コード長 | 357 bytes | 
| コンパイル時間 | 172 ms | 
| コンパイル使用メモリ | 82,412 KB | 
| 実行使用メモリ | 93,524 KB | 
| 最終ジャッジ日時 | 2024-11-18 16:09:34 | 
| 合計ジャッジ時間 | 4,272 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 19 | 
ソースコード
import sys
input = sys.stdin.readline
from bisect import bisect_left
N,M=map(int,input().split())
L=[-(1<<60)]+list(map(int,input().split()))+[1<<60]
FBW=[list(map(int,input().split())) for _ in range(M)]
ans=0
for f,b,w in FBW:
    i = bisect_left(L, f)
    if L[i]==f:
        ans += w
    else:
        ans += max(b, w-(f-L[i-1]), w-(L[i]-f))
print(ans)
            
            
            
        