結果

問題 No.2408 Lakes and Fish
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2023-08-11 22:20:40
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 461 ms / 2,000 ms
コード長 320 bytes
コンパイル時間 616 ms
コンパイル使用メモリ 82,688 KB
実行使用メモリ 93,952 KB
最終ジャッジ日時 2024-04-29 13:20:42
合計ジャッジ時間 7,504 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
51,712 KB
testcase_01 AC 38 ms
51,584 KB
testcase_02 AC 38 ms
51,968 KB
testcase_03 AC 37 ms
51,968 KB
testcase_04 AC 201 ms
93,568 KB
testcase_05 AC 200 ms
93,568 KB
testcase_06 AC 191 ms
93,440 KB
testcase_07 AC 453 ms
93,824 KB
testcase_08 AC 455 ms
93,824 KB
testcase_09 AC 461 ms
93,952 KB
testcase_10 AC 456 ms
93,888 KB
testcase_11 AC 276 ms
83,456 KB
testcase_12 AC 310 ms
89,856 KB
testcase_13 AC 129 ms
79,616 KB
testcase_14 AC 214 ms
81,700 KB
testcase_15 AC 372 ms
88,704 KB
testcase_16 AC 140 ms
83,584 KB
testcase_17 AC 144 ms
79,160 KB
testcase_18 AC 222 ms
87,040 KB
testcase_19 AC 383 ms
86,532 KB
testcase_20 AC 428 ms
87,552 KB
testcase_21 AC 391 ms
86,792 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m = map(int,input().split())
L = [-10**10]+list(map(int,input().split()))+[10**10]

FBW = [list(map(int,input().split())) for i in range(m)]

FBW.sort()

ans = 0

now = 0
for f,b,w in FBW:
    while now < n+2 and L[now] < f:
        now += 1
    
    dist = min(f-L[now-1],L[now]-f)
    ans += max(w-dist,b)
print(ans)
0