結果

問題 No.2408 Lakes and Fish
ユーザー KudeKude
提出日時 2023-08-11 21:25:13
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 214 ms / 2,000 ms
コード長 326 bytes
コンパイル時間 239 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 89,984 KB
最終ジャッジ日時 2024-04-29 12:13:14
合計ジャッジ時間 4,844 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
51,968 KB
testcase_01 AC 41 ms
51,840 KB
testcase_02 AC 41 ms
51,840 KB
testcase_03 AC 42 ms
52,224 KB
testcase_04 AC 182 ms
89,856 KB
testcase_05 AC 188 ms
89,984 KB
testcase_06 AC 189 ms
89,216 KB
testcase_07 AC 212 ms
89,984 KB
testcase_08 AC 214 ms
89,856 KB
testcase_09 AC 214 ms
89,728 KB
testcase_10 AC 209 ms
89,984 KB
testcase_11 AC 153 ms
80,128 KB
testcase_12 AC 177 ms
86,656 KB
testcase_13 AC 119 ms
78,976 KB
testcase_14 AC 146 ms
80,128 KB
testcase_15 AC 191 ms
85,504 KB
testcase_16 AC 131 ms
81,920 KB
testcase_17 AC 125 ms
77,568 KB
testcase_18 AC 148 ms
83,840 KB
testcase_19 AC 186 ms
82,176 KB
testcase_20 AC 183 ms
76,416 KB
testcase_21 AC 186 ms
83,968 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from bisect import bisect_left
n, m = map(int, input().split())
ans = 0
l = list(map(int, input().split()))
ans = 0
for _ in range(m):
    f, b, w = map(int, input().split())
    i = bisect_left(l, f)
    if i < n:
        b = max(b, w - (l[i] - f))
    if i > 0:
        b = max(b, w - (f - l[i - 1]))
    ans += b
print(ans)
0