結果

問題 No.2408 Lakes and Fish
ユーザー flygonflygon
提出日時 2023-08-11 21:29:01
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 184 ms / 2,000 ms
コード長 472 bytes
コンパイル時間 693 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 92,672 KB
最終ジャッジ日時 2024-04-29 12:18:01
合計ジャッジ時間 4,278 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 50 ms
54,400 KB
testcase_01 AC 48 ms
54,016 KB
testcase_02 AC 48 ms
54,272 KB
testcase_03 AC 47 ms
53,888 KB
testcase_04 AC 148 ms
92,672 KB
testcase_05 AC 146 ms
92,288 KB
testcase_06 AC 156 ms
92,032 KB
testcase_07 AC 183 ms
92,160 KB
testcase_08 AC 184 ms
92,288 KB
testcase_09 AC 184 ms
92,544 KB
testcase_10 AC 181 ms
92,416 KB
testcase_11 AC 135 ms
80,256 KB
testcase_12 AC 158 ms
89,216 KB
testcase_13 AC 106 ms
78,848 KB
testcase_14 AC 122 ms
80,256 KB
testcase_15 AC 161 ms
87,296 KB
testcase_16 AC 113 ms
83,072 KB
testcase_17 AC 108 ms
77,440 KB
testcase_18 AC 136 ms
86,016 KB
testcase_19 AC 160 ms
83,328 KB
testcase_20 AC 152 ms
76,416 KB
testcase_21 AC 161 ms
85,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(5*10**5)
input = sys.stdin.readline
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 = [-10**18] + list(map(int,input().split())) + [10**18]
ans = 0
for i in range(m):
    f,bi,wi = map(int,input().split())
    t = bisect_right(l, f)
    d = min(l[t]-f, f-l[t-1])
    ans += max(bi, wi-d)

print(ans)
0