結果
問題 | No.2408 Lakes and Fish |
ユーザー |
![]() |
提出日時 | 2023-08-12 11:55:08 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 247 ms / 2,000 ms |
コード長 | 345 bytes |
コンパイル時間 | 250 ms |
コンパイル使用メモリ | 82,564 KB |
実行使用メモリ | 107,008 KB |
最終ジャッジ日時 | 2024-11-19 12:54:36 |
合計ジャッジ時間 | 5,013 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 19 |
ソースコード
N,M=map(int, input().split()) L=list(map(int, input().split())) A=L.copy() A.append(-10**12) A.append(10**12) A=sorted(A) LL=set(L) import bisect ans=0 for i in range(M): f,b,w=map(int, input().split()) if f in LL: ans+=w else: d=bisect.bisect_left(A,f) x,y=A[d-1],A[d] p=max(b,w-abs(f-x),w-abs(f-y)) ans+=p print(ans)