結果
| 問題 | No.2408 Lakes and Fish | 
| コンテスト | |
| ユーザー |  rlangevin | 
| 提出日時 | 2023-08-11 22:53:22 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 157 ms / 2,000 ms | 
| コード長 | 327 bytes | 
| コンパイル時間 | 163 ms | 
| コンパイル使用メモリ | 82,520 KB | 
| 実行使用メモリ | 92,404 KB | 
| 最終ジャッジ日時 | 2024-11-18 18:02:19 | 
| 合計ジャッジ時間 | 3,870 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 19 | 
ソースコード
import sys
input = sys.stdin.readline
from bisect import *
N, M = map(int, input().split())
inf = 10 ** 18
L = [-inf] + list(map(int, input().split())) + [inf]
ans = 0
for i in range(M):
    F, B, W = map(int, input().split())
    ind = bisect_right(L, F)
    ans += max(B, W - min(L[ind] - F, F - L[ind - 1]))
print(ans)    
            
            
            
        