結果

問題 No.2559 眩しい数直線
ユーザー rotti_coderrotti_coder
提出日時 2023-11-21 01:18:47
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 65 ms / 2,000 ms
コード長 399 bytes
コンパイル時間 351 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 68,152 KB
最終ジャッジ日時 2023-11-21 01:18:50
合計ジャッジ時間 2,766 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
53,460 KB
testcase_01 AC 35 ms
53,460 KB
testcase_02 AC 36 ms
53,460 KB
testcase_03 AC 46 ms
61,700 KB
testcase_04 AC 57 ms
61,832 KB
testcase_05 AC 57 ms
64,020 KB
testcase_06 AC 65 ms
68,152 KB
testcase_07 AC 59 ms
66,076 KB
testcase_08 AC 60 ms
65,804 KB
testcase_09 AC 53 ms
64,016 KB
testcase_10 AC 48 ms
61,632 KB
testcase_11 AC 39 ms
53,460 KB
testcase_12 AC 39 ms
53,460 KB
testcase_13 AC 59 ms
68,152 KB
testcase_14 AC 60 ms
66,072 KB
testcase_15 AC 62 ms
68,152 KB
testcase_16 AC 50 ms
61,968 KB
testcase_17 AC 55 ms
63,704 KB
testcase_18 AC 49 ms
61,828 KB
testcase_19 AC 64 ms
68,152 KB
testcase_20 AC 52 ms
63,888 KB
testcase_21 AC 50 ms
61,968 KB
testcase_22 AC 58 ms
66,084 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,x=map(int,input().split())
amount=[0]*x
stack=[]
for i in range(n):
  a,b=map(int,input().split())
  amount[a-1]=max(amount[a-1],b)
  stack.append(a-1)
iti=0
while len(stack)>iti:
  a=stack[iti]
  if a>0 and amount[a-1]<amount[a]-1:
    amount[a-1]=amount[a]-1
    stack.append(a-1)
  if a<x-1 and amount[a+1]<amount[a]-1:
    amount[a+1]=amount[a]-1
    stack.append(a+1)
  iti+=1
print(*amount)
0