結果
| 問題 |
No.1110 好きな歌
|
| コンテスト | |
| ユーザー |
tyawanmusi
|
| 提出日時 | 2020-07-10 21:33:10 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 1,288 ms / 5,000 ms |
| コード長 | 447 bytes |
| コンパイル時間 | 85 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 55,280 KB |
| 最終ジャッジ日時 | 2024-10-11 08:03:07 |
| 合計ジャッジ時間 | 30,128 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 51 |
ソースコード
from bisect import bisect_left,bisect_right
def position_zip(a,flag):
j=0
d={}
for i in sorted(a):
if i in d:continue
d[i]=j
j+=1
if flag==1:return d
return [d[i] for i in a]
n,d=map(int,input().split())
a=[int(input())for _ in range(n)]+[-10**10]
b=sorted(list(set(a)))
da=position_zip(a,1)
p=[0]*len(da)
for i in a:p[da[i]]+=1
for i in range(1,len(p)):p[i]+=p[i-1]
for i in a[:-1]:
j=bisect_right(b,i-d)-1
print(p[j]-1)
tyawanmusi