結果

問題 No.2408 Lakes and Fish
ユーザー ニックネームニックネーム
提出日時 2023-08-11 21:31:26
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 674 ms / 2,000 ms
コード長 320 bytes
コンパイル時間 127 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 21,832 KB
最終ジャッジ日時 2024-04-29 12:21:10
合計ジャッジ時間 10,353 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
10,752 KB
testcase_01 AC 31 ms
10,752 KB
testcase_02 AC 29 ms
10,752 KB
testcase_03 AC 29 ms
10,752 KB
testcase_04 AC 625 ms
21,652 KB
testcase_05 AC 616 ms
21,652 KB
testcase_06 AC 600 ms
20,492 KB
testcase_07 AC 659 ms
21,708 KB
testcase_08 AC 657 ms
21,828 KB
testcase_09 AC 659 ms
21,700 KB
testcase_10 AC 674 ms
21,832 KB
testcase_11 AC 393 ms
14,468 KB
testcase_12 AC 473 ms
19,412 KB
testcase_13 AC 138 ms
13,496 KB
testcase_14 AC 296 ms
14,596 KB
testcase_15 AC 549 ms
18,264 KB
testcase_16 AC 172 ms
16,296 KB
testcase_17 AC 171 ms
12,544 KB
testcase_18 AC 306 ms
17,812 KB
testcase_19 AC 534 ms
16,344 KB
testcase_20 AC 590 ms
11,008 KB
testcase_21 AC 551 ms
16,948 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from bisect import bisect_left
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())
    i = bisect_left(l,f)
    c = 0 if i<n and l[i]==f else 10**9
    if i>0: c = min(c,f-l[i-1])
    if i<n: c = min(c,l[i]-f)
    ans += max(b,w-c)
print(ans)
0