結果

問題 No.2408 Lakes and Fish
ユーザー MottchanMottchan
提出日時 2023-08-12 08:59:15
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 214 ms / 2,000 ms
コード長 478 bytes
コンパイル時間 164 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 90,752 KB
最終ジャッジ日時 2024-04-29 23:25:28
合計ジャッジ時間 4,820 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 45 ms
54,016 KB
testcase_01 AC 47 ms
54,272 KB
testcase_02 AC 45 ms
54,144 KB
testcase_03 AC 48 ms
54,144 KB
testcase_04 AC 177 ms
90,112 KB
testcase_05 AC 176 ms
90,496 KB
testcase_06 AC 185 ms
89,984 KB
testcase_07 AC 200 ms
90,624 KB
testcase_08 AC 206 ms
90,752 KB
testcase_09 AC 214 ms
90,624 KB
testcase_10 AC 207 ms
90,752 KB
testcase_11 AC 161 ms
80,896 KB
testcase_12 AC 175 ms
86,784 KB
testcase_13 AC 117 ms
79,232 KB
testcase_14 AC 146 ms
80,640 KB
testcase_15 AC 185 ms
85,504 KB
testcase_16 AC 125 ms
82,144 KB
testcase_17 AC 125 ms
77,824 KB
testcase_18 AC 149 ms
84,608 KB
testcase_19 AC 189 ms
81,920 KB
testcase_20 AC 185 ms
76,800 KB
testcase_21 AC 187 ms
84,096 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict, deque, Counter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right
from math import gcd

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