結果

問題 No.2408 Lakes and Fish
ユーザー mattu34mattu34
提出日時 2023-09-04 23:48:07
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 278 ms / 2,000 ms
コード長 378 bytes
コンパイル時間 396 ms
コンパイル使用メモリ 87,080 KB
実行使用メモリ 96,840 KB
最終ジャッジ日時 2023-09-04 23:48:15
合計ジャッジ時間 7,247 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 94 ms
71,624 KB
testcase_01 AC 92 ms
71,948 KB
testcase_02 AC 100 ms
71,556 KB
testcase_03 AC 99 ms
71,664 KB
testcase_04 AC 230 ms
95,692 KB
testcase_05 AC 222 ms
95,500 KB
testcase_06 AC 233 ms
94,888 KB
testcase_07 AC 252 ms
96,840 KB
testcase_08 AC 260 ms
96,744 KB
testcase_09 AC 278 ms
96,592 KB
testcase_10 AC 257 ms
96,800 KB
testcase_11 AC 199 ms
83,028 KB
testcase_12 AC 223 ms
91,628 KB
testcase_13 AC 160 ms
81,624 KB
testcase_14 AC 199 ms
83,080 KB
testcase_15 AC 231 ms
90,036 KB
testcase_16 AC 170 ms
86,152 KB
testcase_17 AC 167 ms
79,748 KB
testcase_18 AC 198 ms
88,452 KB
testcase_19 AC 230 ms
86,244 KB
testcase_20 AC 232 ms
78,412 KB
testcase_21 AC 230 ms
88,256 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import *
import heapq
import bisect

INF = float("inf")

N, M = map(int, input().split())
L = [-INF] + list(map(int, input().split())) + [INF]
ans = 0
for _ in range(M):
    F, B, W = map(int, input().split())
    pl = bisect.bisect_left(L, F)
    ans += max(B, W - min(L[pl] - F, F - L[pl - 1]))
    # print(F, B, W - min(L[pl] - F, F - L[pl - 1]))
print(ans)
0