結果

問題 No.2408 Lakes and Fish
ユーザー ikomaikoma
提出日時 2023-08-11 21:55:53
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 189 ms / 2,000 ms
コード長 357 bytes
コンパイル時間 175 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 93,312 KB
最終ジャッジ日時 2024-04-29 12:50:35
合計ジャッジ時間 4,406 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
51,968 KB
testcase_01 AC 40 ms
51,840 KB
testcase_02 AC 37 ms
52,096 KB
testcase_03 AC 38 ms
52,224 KB
testcase_04 AC 153 ms
92,672 KB
testcase_05 AC 145 ms
92,820 KB
testcase_06 AC 154 ms
92,800 KB
testcase_07 AC 186 ms
93,312 KB
testcase_08 AC 189 ms
92,672 KB
testcase_09 AC 183 ms
92,864 KB
testcase_10 AC 177 ms
93,312 KB
testcase_11 AC 123 ms
83,456 KB
testcase_12 AC 147 ms
88,960 KB
testcase_13 AC 85 ms
79,360 KB
testcase_14 AC 111 ms
81,724 KB
testcase_15 AC 161 ms
87,424 KB
testcase_16 AC 96 ms
83,072 KB
testcase_17 AC 89 ms
79,488 KB
testcase_18 AC 118 ms
85,376 KB
testcase_19 AC 152 ms
85,444 KB
testcase_20 AC 154 ms
86,400 KB
testcase_21 AC 153 ms
85,804 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
from bisect import bisect_left
N,M=map(int,input().split())
L=[-(1<<60)]+list(map(int,input().split()))+[1<<60]
FBW=[list(map(int,input().split())) for _ in range(M)]
ans=0

for f,b,w in FBW:
    i = bisect_left(L, f)
    if L[i]==f:
        ans += w
    else:
        ans += max(b, w-(f-L[i-1]), w-(L[i]-f))
print(ans)
0