結果

問題 No.2559 眩しい数直線
ユーザー YuuuTYuuuT
提出日時 2023-12-02 14:39:23
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 78 ms / 2,000 ms
コード長 843 bytes
コンパイル時間 297 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 76,296 KB
最終ジャッジ日時 2023-12-02 14:39:27
合計ジャッジ時間 2,523 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
55,628 KB
testcase_01 AC 42 ms
55,628 KB
testcase_02 AC 42 ms
55,628 KB
testcase_03 AC 55 ms
66,124 KB
testcase_04 AC 56 ms
66,128 KB
testcase_05 AC 61 ms
68,848 KB
testcase_06 AC 78 ms
76,296 KB
testcase_07 AC 69 ms
72,976 KB
testcase_08 AC 66 ms
72,968 KB
testcase_09 AC 65 ms
70,912 KB
testcase_10 AC 61 ms
68,856 KB
testcase_11 AC 47 ms
61,668 KB
testcase_12 AC 50 ms
63,928 KB
testcase_13 AC 69 ms
73,500 KB
testcase_14 AC 68 ms
72,984 KB
testcase_15 AC 69 ms
73,884 KB
testcase_16 AC 54 ms
66,264 KB
testcase_17 AC 63 ms
70,912 KB
testcase_18 AC 57 ms
66,128 KB
testcase_19 AC 70 ms
73,756 KB
testcase_20 AC 61 ms
68,856 KB
testcase_21 AC 55 ms
66,128 KB
testcase_22 AC 67 ms
72,984 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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:])
0