結果
| 問題 |
No.1110 好きな歌
|
| コンテスト | |
| ユーザー |
mkawa2
|
| 提出日時 | 2020-07-10 21:37:37 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 829 ms / 5,000 ms |
| コード長 | 956 bytes |
| コンパイル時間 | 111 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 51,036 KB |
| 最終ジャッジ日時 | 2024-10-11 08:19:39 |
| 合計ジャッジ時間 | 20,385 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 51 |
ソースコード
from operator import itemgetter
from itertools import *
from bisect import *
from collections import *
from heapq import *
from fractions import Fraction
import sys
sys.setrecursionlimit(10 ** 6)
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def SI(): return sys.stdin.readline()[:-1]
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
int1 = lambda x: int(x) - 1
def MI1(): return map(int1, sys.stdin.readline().split())
def LI1(): return list(map(int1, sys.stdin.readline().split()))
p2D = lambda x: print(*x, sep="\n")
dij = [(1, 0), (0, 1), (-1, 0), (0, -1)]
n,d=MI()
q=deque()
aj=[(II(),i) for i in range(n)]
aj.sort()
ans=[0]*n
for i,(a,j) in enumerate(aj):
while q and q[0]<=a-d:q.popleft()
ans[j]=i-len(q)
q.append(a)
print(*ans,sep="\n")
mkawa2