結果

問題 No.2408 Lakes and Fish
ユーザー lloyzlloyz
提出日時 2023-08-17 10:26:55
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 188 ms / 2,000 ms
コード長 390 bytes
コンパイル時間 542 ms
コンパイル使用メモリ 86,888 KB
実行使用メモリ 91,136 KB
最終ジャッジ日時 2023-08-17 10:27:01
合計ジャッジ時間 5,689 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,196 KB
testcase_01 AC 68 ms
71,248 KB
testcase_02 AC 68 ms
71,244 KB
testcase_03 AC 69 ms
71,328 KB
testcase_04 AC 147 ms
91,080 KB
testcase_05 AC 145 ms
91,136 KB
testcase_06 AC 155 ms
90,496 KB
testcase_07 AC 188 ms
90,636 KB
testcase_08 AC 178 ms
90,360 KB
testcase_09 AC 179 ms
90,628 KB
testcase_10 AC 178 ms
90,548 KB
testcase_11 AC 135 ms
80,804 KB
testcase_12 AC 152 ms
87,660 KB
testcase_13 AC 112 ms
79,476 KB
testcase_14 AC 125 ms
80,972 KB
testcase_15 AC 157 ms
86,536 KB
testcase_16 AC 116 ms
82,412 KB
testcase_17 AC 110 ms
77,880 KB
testcase_18 AC 133 ms
85,004 KB
testcase_19 AC 155 ms
82,680 KB
testcase_20 AC 149 ms
77,372 KB
testcase_21 AC 168 ms
84,864 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from bisect import bisect_left
import sys
input = sys.stdin.readline

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)
    res = b
    if idx < n:
        res = max(res, w - (L[idx] - f))
    if idx > 0:
        res = max(res, w - (f - L[idx - 1]))
    ans += res
print(ans)
0