結果

問題 No.2408 Lakes and Fish
ユーザー ntudantuda
提出日時 2023-08-12 11:29:09
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 254 ms / 2,000 ms
コード長 348 bytes
コンパイル時間 222 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 91,520 KB
最終ジャッジ日時 2024-04-30 01:29:36
合計ジャッジ時間 5,597 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
52,096 KB
testcase_01 AC 44 ms
52,224 KB
testcase_02 AC 42 ms
52,224 KB
testcase_03 AC 43 ms
51,968 KB
testcase_04 AC 219 ms
91,136 KB
testcase_05 AC 215 ms
91,008 KB
testcase_06 AC 229 ms
91,008 KB
testcase_07 AC 252 ms
91,264 KB
testcase_08 AC 250 ms
91,264 KB
testcase_09 AC 254 ms
91,520 KB
testcase_10 AC 249 ms
91,136 KB
testcase_11 AC 180 ms
82,944 KB
testcase_12 AC 210 ms
88,192 KB
testcase_13 AC 126 ms
78,976 KB
testcase_14 AC 162 ms
81,920 KB
testcase_15 AC 228 ms
86,656 KB
testcase_16 AC 141 ms
82,432 KB
testcase_17 AC 137 ms
79,360 KB
testcase_18 AC 171 ms
85,120 KB
testcase_19 AC 223 ms
85,692 KB
testcase_20 AC 225 ms
86,784 KB
testcase_21 AC 225 ms
86,640 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from bisect import *

N, M = map(int, input().split())
L = list(map(int, input().split()))
FBW = [list(map(int, input().split())) for _ in range(M)]

ans = 0
for f, b, w in FBW:
    a = bisect_left(L, f)
    tmp = b
    if a > 0:
        tmp = max(tmp, w - f + L[a - 1])
    if a < N:
        tmp = max(tmp, w - L[a] + f)
    ans += tmp
print(ans)
0