結果
問題 |
No.2408 Lakes and Fish
|
ユーザー |
|
提出日時 | 2023-08-12 08:51:18 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 565 bytes |
コンパイル時間 | 168 ms |
コンパイル使用メモリ | 82,188 KB |
実行使用メモリ | 90,764 KB |
最終ジャッジ日時 | 2024-11-19 08:15:31 |
合計ジャッジ時間 | 4,979 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 2 WA * 17 |
ソースコード
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 == 0: ans+=max(w-(l[idx]-f), b) elif idx < n: if abs(l[idx-1]-f) < abs(l[idx]-f): ans+=max(w-(l[idx-1]-f), b) else: ans+=max(w-(l[idx]-f), b) else: ans+=max(w-(f-l[-1]),b) print(ans)