結果

問題 No.2408 Lakes and Fish
ユーザー 👑 rin204rin204
提出日時 2023-08-11 21:24:18
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 212 ms / 2,000 ms
コード長 318 bytes
コンパイル時間 246 ms
コンパイル使用メモリ 81,792 KB
実行使用メモリ 92,800 KB
最終ジャッジ日時 2024-04-29 12:12:49
合計ジャッジ時間 4,826 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
52,224 KB
testcase_01 AC 41 ms
52,096 KB
testcase_02 AC 42 ms
51,968 KB
testcase_03 AC 41 ms
52,096 KB
testcase_04 AC 185 ms
92,288 KB
testcase_05 AC 182 ms
92,544 KB
testcase_06 AC 192 ms
92,160 KB
testcase_07 AC 212 ms
92,544 KB
testcase_08 AC 212 ms
92,416 KB
testcase_09 AC 212 ms
92,416 KB
testcase_10 AC 209 ms
92,800 KB
testcase_11 AC 156 ms
81,152 KB
testcase_12 AC 178 ms
88,320 KB
testcase_13 AC 120 ms
79,616 KB
testcase_14 AC 144 ms
81,024 KB
testcase_15 AC 189 ms
86,912 KB
testcase_16 AC 129 ms
83,456 KB
testcase_17 AC 122 ms
78,336 KB
testcase_18 AC 151 ms
85,120 KB
testcase_19 AC 185 ms
83,584 KB
testcase_20 AC 182 ms
76,288 KB
testcase_21 AC 188 ms
85,120 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from bisect import bisect_left, bisect_right

n, m = map(int, input().split())
L = [-1 << 40] + list(map(int, input().split())) + [1 << 40]
ans = 0
for _ in range(m):
    f, b, w = map(int, input().split())
    p = bisect_left(L, f)
    dl = f - L[p - 1]
    dr = L[p] - f
    ans += max(b, w - min(dl, dr))
print(ans)
0