結果

問題 No.2408 Lakes and Fish
ユーザー Mottchan
提出日時 2023-08-12 08:41:00
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 480 bytes
コンパイル時間 327 ms
コンパイル使用メモリ 82,136 KB
実行使用メモリ 90,772 KB
最終ジャッジ日時 2024-11-19 08:03:45
合計ジャッジ時間 5,041 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 2 WA * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(5*10**5)
input = sys.stdin.readline
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 < n:
        ans+=max(w-(l[idx]-f), b)
    else:
        ans+=max(w-(f-l[-1]),b)

print(ans)
0