結果
| 問題 | No.2408 Lakes and Fish |
| コンテスト | |
| ユーザー |
timi
|
| 提出日時 | 2023-08-12 11:55:08 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 179 ms / 2,000 ms |
| コード長 | 345 bytes |
| 記録 | |
| コンパイル時間 | 148 ms |
| コンパイル使用メモリ | 85,248 KB |
| 実行使用メモリ | 113,900 KB |
| 最終ジャッジ日時 | 2026-05-13 19:37:19 |
| 合計ジャッジ時間 | 4,157 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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)
timi