結果

問題 No.2408 Lakes and Fish
ユーザー hiryuNhiryuN
提出日時 2023-08-11 21:35:20
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 374 ms / 2,000 ms
コード長 307 bytes
コンパイル時間 207 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 93,440 KB
最終ジャッジ日時 2024-04-29 12:25:30
合計ジャッジ時間 6,829 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
51,840 KB
testcase_01 AC 40 ms
51,968 KB
testcase_02 AC 41 ms
51,968 KB
testcase_03 AC 40 ms
51,968 KB
testcase_04 AC 367 ms
93,440 KB
testcase_05 AC 367 ms
93,184 KB
testcase_06 AC 336 ms
92,032 KB
testcase_07 AC 374 ms
93,440 KB
testcase_08 AC 361 ms
93,440 KB
testcase_09 AC 370 ms
93,184 KB
testcase_10 AC 366 ms
93,440 KB
testcase_11 AC 241 ms
81,152 KB
testcase_12 AC 279 ms
89,216 KB
testcase_13 AC 136 ms
79,744 KB
testcase_14 AC 198 ms
81,024 KB
testcase_15 AC 315 ms
87,168 KB
testcase_16 AC 145 ms
83,200 KB
testcase_17 AC 146 ms
77,440 KB
testcase_18 AC 204 ms
85,888 KB
testcase_19 AC 314 ms
83,584 KB
testcase_20 AC 351 ms
76,928 KB
testcase_21 AC 327 ms
85,888 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m=map(int,input().split())
L=list(map(int,input().split()))
L=[-10**10]+L+[10**10]
ans=0
for i in range(m):
	x,a,b=map(int,input().split())
	co=0
	for j in reversed(range(60)):
		co+=2**j
		if co>=n+2:
			co-=2**j
		else:
			if L[co]>x:
				co-=2**j
	ans+=max(a,b-abs(x-L[co]),b-abs(x-L[co+1]))
print(ans)
0