結果

問題 No.1110 好きな歌
ユーザー Navier_Boltzmann
提出日時 2024-04-06 20:40:50
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 269 ms / 5,000 ms
コード長 526 bytes
コンパイル時間 329 ms
コンパイル使用メモリ 82,260 KB
実行使用メモリ 81,904 KB
最終ジャッジ日時 2024-10-01 04:03:34
合計ジャッジ時間 11,209 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 51
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import *
from itertools import *
from functools import *
from heapq import *
import sys,math
input = sys.stdin.readline




N,D = map(int,input().split())
A = [int(input()) for _ in range(N)]

def cle(a,D):
    
    y = len(D)-1
    x = 0
    if D[x]>a:
        return 0
        
    if D[y]<=a:
        return y+1
    
    while y-x>1:
        mid = (y+x)//2
        if D[mid]<=a:
            x = mid
        else:
            y = mid
    return y




B = A[:]
B.sort()
for a in A:
    print(cle(a-D,B))
    
0