結果

問題 No.2408 Lakes and Fish
ユーザー titiatitia
提出日時 2023-08-11 21:29:19
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 706 ms / 2,000 ms
コード長 334 bytes
コンパイル時間 97 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 21,712 KB
最終ジャッジ日時 2024-04-29 12:18:47
合計ジャッジ時間 10,534 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
10,624 KB
testcase_01 AC 32 ms
10,624 KB
testcase_02 AC 33 ms
10,752 KB
testcase_03 AC 35 ms
10,624 KB
testcase_04 AC 624 ms
21,528 KB
testcase_05 AC 617 ms
21,400 KB
testcase_06 AC 615 ms
20,600 KB
testcase_07 AC 696 ms
21,580 KB
testcase_08 AC 692 ms
21,704 KB
testcase_09 AC 691 ms
21,712 KB
testcase_10 AC 706 ms
21,708 KB
testcase_11 AC 392 ms
14,340 KB
testcase_12 AC 491 ms
19,548 KB
testcase_13 AC 141 ms
13,380 KB
testcase_14 AC 298 ms
14,476 KB
testcase_15 AC 577 ms
18,144 KB
testcase_16 AC 175 ms
16,176 KB
testcase_17 AC 175 ms
12,416 KB
testcase_18 AC 313 ms
17,692 KB
testcase_19 AC 560 ms
16,224 KB
testcase_20 AC 600 ms
10,880 KB
testcase_21 AC 583 ms
17,088 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

from bisect import bisect

N,M=map(int,input().split())

L=list(map(int,input().split()))

ANS=0

for i in range(M):
    x,y,z=map(int,input().split())

    PLUS=y

    k=bisect(L,x)

    for j in range(max(0,k-2),min(len(L),k+2)):
        PLUS=max(PLUS,z-abs(x-L[j]))

    ANS+=PLUS
print(ANS)
0