結果
| 問題 | No.2559 眩しい数直線 | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2023-12-02 14:39:23 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 77 ms / 2,000 ms | 
| コード長 | 843 bytes | 
| コンパイル時間 | 261 ms | 
| コンパイル使用メモリ | 82,304 KB | 
| 実行使用メモリ | 76,588 KB | 
| 最終ジャッジ日時 | 2024-09-26 17:03:55 | 
| 合計ジャッジ時間 | 2,364 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 20 | 
ソースコード
import sys,math
#if len(sys.argv)==2:sys.stdin=open(sys.argv[1])
from collections import defaultdict,deque
from itertools import combinations,permutations,accumulate,product
from bisect import bisect,bisect_left,bisect_right
from heapq import heappop,heappush,heapify
#from sortedcontainers import SortedList,SortedSet
def input(): return sys.stdin.readline().rstrip()
def ii(): return int(input())
def ms(): return map(int, input().split())
def li(): return list(map(int,input().split()))
#////////////////////////////////////
N,X = ms()
ans = [0]*(X+1)
for _ in range(N):
  a,b = ms()
  ans[a] = max(ans[a],b)
  tmp = b-1
  for a2 in reversed(range(1,a)):
    ans[a2] = max(ans[a2],tmp)
    tmp -= 1
    if tmp==0: break
  tmp = b-1
  for a2 in range(a+1,X+1):
    ans[a2] = max(ans[a2],tmp)
    tmp -= 1
    if tmp==0: break
print(*ans[1:])
            
            
            
        