結果

問題 No.2408 Lakes and Fish
ユーザー mymelochanmymelochan
提出日時 2023-08-11 21:34:01
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 256 ms / 2,000 ms
コード長 752 bytes
コンパイル時間 278 ms
コンパイル使用メモリ 87,300 KB
実行使用メモリ 92,472 KB
最終ジャッジ日時 2023-08-11 21:34:07
合計ジャッジ時間 5,838 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 93 ms
71,888 KB
testcase_01 AC 94 ms
71,636 KB
testcase_02 AC 93 ms
71,808 KB
testcase_03 AC 91 ms
71,836 KB
testcase_04 AC 208 ms
91,772 KB
testcase_05 AC 197 ms
91,868 KB
testcase_06 AC 198 ms
91,496 KB
testcase_07 AC 222 ms
92,324 KB
testcase_08 AC 219 ms
92,000 KB
testcase_09 AC 256 ms
92,204 KB
testcase_10 AC 221 ms
92,472 KB
testcase_11 AC 174 ms
81,388 KB
testcase_12 AC 191 ms
88,908 KB
testcase_13 AC 138 ms
80,384 KB
testcase_14 AC 161 ms
81,716 KB
testcase_15 AC 216 ms
87,376 KB
testcase_16 AC 145 ms
83,780 KB
testcase_17 AC 146 ms
78,868 KB
testcase_18 AC 173 ms
86,316 KB
testcase_19 AC 206 ms
84,192 KB
testcase_20 AC 197 ms
78,436 KB
testcase_21 AC 209 ms
85,992 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#############################################################

import sys
sys.setrecursionlimit(10**7)

from heapq import heappop,heappush
from collections import deque,defaultdict,Counter
from bisect import bisect_left, bisect_right
from itertools import product,combinations,permutations
from math import sin,cos
#from math import isqrt #DO NOT USE PyPy

ipt = sys.stdin.readline
iin = lambda :int(ipt())
lmin = lambda :list(map(int,ipt().split()))

#############################################################

N,M = lmin()
L = lmin()

ans = 0
for _ in range(M):
    F,B,W = lmin()
    t = B
    idx = bisect_left(L,F)
    if idx != 0:
        t = max(t,W-abs(F-L[idx-1]))
    if idx != N:
        t = max(t,W-abs(F-L[idx]))
    ans += t
print(ans)
0