結果
| 問題 |
No.2408 Lakes and Fish
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-08-12 08:59:15 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 189 ms / 2,000 ms |
| コード長 | 478 bytes |
| コンパイル時間 | 490 ms |
| コンパイル使用メモリ | 82,364 KB |
| 実行使用メモリ | 90,776 KB |
| 最終ジャッジ日時 | 2024-11-19 08:24:01 |
| 合計ジャッジ時間 | 4,798 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 19 |
ソースコード
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:
ans+=max(w-(f-l[idx-1]),w-(l[idx]-f), b)
else:
ans+=max(w-(f-l[-1]),b)
print(ans)