結果

問題 No.2559 眩しい数直線
ユーザー masaABmasaAB
提出日時 2024-01-04 14:41:00
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 405 ms / 2,000 ms
コード長 449 bytes
コンパイル時間 318 ms
コンパイル使用メモリ 11,904 KB
実行使用メモリ 10,240 KB
最終ジャッジ日時 2024-01-04 14:41:06
合計ジャッジ時間 5,426 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
10,112 KB
testcase_01 AC 28 ms
10,112 KB
testcase_02 AC 29 ms
10,112 KB
testcase_03 AC 93 ms
10,112 KB
testcase_04 AC 105 ms
10,112 KB
testcase_05 AC 155 ms
10,112 KB
testcase_06 AC 405 ms
10,240 KB
testcase_07 AC 226 ms
10,112 KB
testcase_08 AC 141 ms
10,112 KB
testcase_09 AC 254 ms
10,240 KB
testcase_10 AC 100 ms
10,112 KB
testcase_11 AC 30 ms
10,112 KB
testcase_12 AC 46 ms
10,112 KB
testcase_13 AC 392 ms
10,240 KB
testcase_14 AC 254 ms
10,240 KB
testcase_15 AC 371 ms
10,240 KB
testcase_16 AC 40 ms
10,112 KB
testcase_17 AC 167 ms
10,112 KB
testcase_18 AC 99 ms
10,112 KB
testcase_19 AC 390 ms
10,240 KB
testcase_20 AC 121 ms
10,112 KB
testcase_21 AC 57 ms
10,112 KB
testcase_22 AC 296 ms
10,240 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

res = [0] * X
indexlist = set()

for _ in range(N):
	index, val = map(int, input().split())
	res[index-1] = max(val, res[index-1])
	indexlist.add(index-1)

for i in indexlist:
	cur = res[i] - 1
	cur1 = res[i] - 1
	for j in range(i+1, X):
		ans = max(cur, 0)
		res[j] = max(res[j], ans)
		cur -= 1
	    
	for j in reversed(range(0, i)):
		ans = max(cur1, 0)
		res[j] = max(res[j], ans)
		cur1 -= 1
			
print(*res)


0