結果

問題 No.1110 好きな歌
ユーザー tyawanmusityawanmusi
提出日時 2020-07-10 21:33:10
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,205 ms / 5,000 ms
コード長 447 bytes
コンパイル時間 75 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 55,356 KB
最終ジャッジ日時 2024-04-19 15:56:29
合計ジャッジ時間 27,270 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
10,880 KB
testcase_01 AC 29 ms
10,880 KB
testcase_02 AC 29 ms
10,880 KB
testcase_03 AC 29 ms
10,880 KB
testcase_04 AC 27 ms
10,880 KB
testcase_05 AC 27 ms
10,880 KB
testcase_06 AC 27 ms
10,880 KB
testcase_07 AC 27 ms
10,752 KB
testcase_08 AC 27 ms
10,880 KB
testcase_09 AC 27 ms
10,752 KB
testcase_10 AC 28 ms
10,752 KB
testcase_11 AC 26 ms
10,752 KB
testcase_12 AC 27 ms
10,880 KB
testcase_13 AC 27 ms
10,880 KB
testcase_14 AC 29 ms
10,880 KB
testcase_15 AC 28 ms
10,752 KB
testcase_16 AC 28 ms
10,880 KB
testcase_17 AC 29 ms
10,880 KB
testcase_18 AC 27 ms
10,752 KB
testcase_19 AC 31 ms
10,880 KB
testcase_20 AC 31 ms
10,880 KB
testcase_21 AC 29 ms
10,752 KB
testcase_22 AC 31 ms
11,008 KB
testcase_23 AC 29 ms
10,752 KB
testcase_24 AC 649 ms
35,220 KB
testcase_25 AC 775 ms
38,384 KB
testcase_26 AC 411 ms
24,624 KB
testcase_27 AC 780 ms
38,096 KB
testcase_28 AC 435 ms
25,648 KB
testcase_29 AC 946 ms
40,432 KB
testcase_30 AC 428 ms
25,660 KB
testcase_31 AC 270 ms
21,752 KB
testcase_32 AC 1,030 ms
53,012 KB
testcase_33 AC 491 ms
32,524 KB
testcase_34 AC 670 ms
36,580 KB
testcase_35 AC 1,042 ms
55,124 KB
testcase_36 AC 130 ms
14,640 KB
testcase_37 AC 294 ms
22,424 KB
testcase_38 AC 920 ms
40,244 KB
testcase_39 AC 680 ms
35,608 KB
testcase_40 AC 821 ms
39,696 KB
testcase_41 AC 84 ms
13,408 KB
testcase_42 AC 935 ms
52,620 KB
testcase_43 AC 925 ms
40,212 KB
testcase_44 AC 1,064 ms
55,156 KB
testcase_45 AC 1,140 ms
55,244 KB
testcase_46 AC 1,095 ms
55,104 KB
testcase_47 AC 1,195 ms
55,024 KB
testcase_48 AC 1,116 ms
55,136 KB
testcase_49 AC 1,005 ms
55,356 KB
testcase_50 AC 1,124 ms
55,092 KB
testcase_51 AC 1,092 ms
55,092 KB
testcase_52 AC 1,140 ms
55,092 KB
testcase_53 AC 1,205 ms
55,068 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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