結果
問題 | No.2559 眩しい数直線 |
ユーザー |
![]() |
提出日時 | 2023-11-21 01:18:47 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 73 ms / 2,000 ms |
コード長 | 399 bytes |
コンパイル時間 | 207 ms |
コンパイル使用メモリ | 82,560 KB |
実行使用メモリ | 67,584 KB |
最終ジャッジ日時 | 2024-09-26 06:49:32 |
合計ジャッジ時間 | 2,581 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 |
ソースコード
n,x=map(int,input().split())amount=[0]*xstack=[]for i in range(n):a,b=map(int,input().split())amount[a-1]=max(amount[a-1],b)stack.append(a-1)iti=0while len(stack)>iti:a=stack[iti]if a>0 and amount[a-1]<amount[a]-1:amount[a-1]=amount[a]-1stack.append(a-1)if a<x-1 and amount[a+1]<amount[a]-1:amount[a+1]=amount[a]-1stack.append(a+1)iti+=1print(*amount)