結果

問題 No.2408 Lakes and Fish
ユーザー sotanishysotanishy
提出日時 2023-08-11 22:08:46
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 179 ms / 2,000 ms
コード長 371 bytes
コンパイル時間 219 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 89,984 KB
最終ジャッジ日時 2024-04-29 13:07:14
合計ジャッジ時間 3,880 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
52,096 KB
testcase_01 AC 43 ms
51,840 KB
testcase_02 AC 43 ms
52,096 KB
testcase_03 AC 38 ms
52,352 KB
testcase_04 AC 132 ms
88,960 KB
testcase_05 AC 128 ms
88,960 KB
testcase_06 AC 136 ms
88,448 KB
testcase_07 AC 164 ms
89,600 KB
testcase_08 AC 161 ms
89,728 KB
testcase_09 AC 160 ms
89,984 KB
testcase_10 AC 179 ms
89,752 KB
testcase_11 AC 112 ms
79,124 KB
testcase_12 AC 135 ms
86,156 KB
testcase_13 AC 86 ms
77,660 KB
testcase_14 AC 104 ms
79,360 KB
testcase_15 AC 140 ms
85,272 KB
testcase_16 AC 94 ms
81,536 KB
testcase_17 AC 88 ms
76,800 KB
testcase_18 AC 111 ms
83,552 KB
testcase_19 AC 139 ms
81,152 KB
testcase_20 AC 134 ms
75,980 KB
testcase_21 AC 140 ms
83,200 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())
    k = bisect_left(L, F)
    res = B
    if k > 0:
        res = max(res, W-(F-L[k-1]))
    if k < N:
        res = max(res, W-(L[k]-F))
    ans += res

print(ans)
0