結果
| 問題 | No.2408 Lakes and Fish | 
| コンテスト | |
| ユーザー |  mattu34 | 
| 提出日時 | 2023-09-04 23:48:07 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 280 ms / 2,000 ms | 
| コード長 | 378 bytes | 
| コンパイル時間 | 272 ms | 
| コンパイル使用メモリ | 82,324 KB | 
| 実行使用メモリ | 93,948 KB | 
| 最終ジャッジ日時 | 2024-06-22 21:02:04 | 
| 合計ジャッジ時間 | 4,653 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 19 | 
ソースコード
from collections import *
import heapq
import bisect
INF = float("inf")
N, M = map(int, input().split())
L = [-INF] + list(map(int, input().split())) + [INF]
ans = 0
for _ in range(M):
    F, B, W = map(int, input().split())
    pl = bisect.bisect_left(L, F)
    ans += max(B, W - min(L[pl] - F, F - L[pl - 1]))
    # print(F, B, W - min(L[pl] - F, F - L[pl - 1]))
print(ans)
            
            
            
        