結果
問題 |
No.2408 Lakes and Fish
|
ユーザー |
|
提出日時 | 2023-08-12 08:45:54 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 634 bytes |
コンパイル時間 | 332 ms |
コンパイル使用メモリ | 82,432 KB |
実行使用メモリ | 90,752 KB |
最終ジャッジ日時 | 2024-11-19 08:09:16 |
合計ジャッジ時間 | 4,144 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 2 WA * 17 |
ソースコード
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 == 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)