結果

問題 No.2408 Lakes and Fish
ユーザー rlangevinrlangevin
提出日時 2023-08-11 22:53:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 172 ms / 2,000 ms
コード長 327 bytes
コンパイル時間 287 ms
コンパイル使用メモリ 81,792 KB
実行使用メモリ 92,032 KB
最終ジャッジ日時 2024-04-29 14:02:15
合計ジャッジ時間 4,133 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
51,840 KB
testcase_01 AC 42 ms
51,456 KB
testcase_02 AC 40 ms
51,712 KB
testcase_03 AC 41 ms
51,712 KB
testcase_04 AC 138 ms
91,136 KB
testcase_05 AC 139 ms
91,264 KB
testcase_06 AC 150 ms
90,880 KB
testcase_07 AC 170 ms
91,776 KB
testcase_08 AC 172 ms
91,520 KB
testcase_09 AC 172 ms
92,032 KB
testcase_10 AC 168 ms
91,904 KB
testcase_11 AC 123 ms
79,616 KB
testcase_12 AC 143 ms
88,192 KB
testcase_13 AC 94 ms
78,080 KB
testcase_14 AC 114 ms
80,128 KB
testcase_15 AC 151 ms
86,272 KB
testcase_16 AC 101 ms
82,432 KB
testcase_17 AC 97 ms
76,416 KB
testcase_18 AC 126 ms
85,120 KB
testcase_19 AC 145 ms
82,432 KB
testcase_20 AC 141 ms
76,160 KB
testcase_21 AC 153 ms
84,608 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
from bisect import *

N, M = map(int, input().split())
inf = 10 ** 18
L = [-inf] + list(map(int, input().split())) + [inf]
ans = 0
for i in range(M):
    F, B, W = map(int, input().split())
    ind = bisect_right(L, F)
    ans += max(B, W - min(L[ind] - F, F - L[ind - 1]))

print(ans)    
0