結果

問題 No.1110 好きな歌
ユーザー McGregorshMcGregorsh
提出日時 2022-07-10 14:09:39
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 394 ms / 5,000 ms
コード長 1,691 bytes
コンパイル時間 354 ms
コンパイル使用メモリ 86,928 KB
実行使用メモリ 101,012 KB
最終ジャッジ日時 2023-08-31 01:06:21
合計ジャッジ時間 23,044 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 192 ms
92,536 KB
testcase_01 AC 191 ms
92,552 KB
testcase_02 AC 193 ms
92,428 KB
testcase_03 AC 192 ms
92,284 KB
testcase_04 AC 194 ms
92,544 KB
testcase_05 AC 190 ms
92,516 KB
testcase_06 AC 194 ms
92,448 KB
testcase_07 AC 191 ms
92,284 KB
testcase_08 AC 197 ms
92,436 KB
testcase_09 AC 192 ms
92,284 KB
testcase_10 AC 193 ms
92,412 KB
testcase_11 AC 196 ms
92,264 KB
testcase_12 AC 190 ms
92,440 KB
testcase_13 AC 190 ms
92,292 KB
testcase_14 AC 199 ms
93,204 KB
testcase_15 AC 198 ms
92,300 KB
testcase_16 AC 202 ms
93,236 KB
testcase_17 AC 207 ms
93,224 KB
testcase_18 AC 195 ms
92,452 KB
testcase_19 AC 210 ms
93,252 KB
testcase_20 AC 205 ms
93,292 KB
testcase_21 AC 206 ms
92,836 KB
testcase_22 AC 207 ms
92,996 KB
testcase_23 AC 195 ms
92,304 KB
testcase_24 AC 312 ms
97,612 KB
testcase_25 AC 326 ms
98,412 KB
testcase_26 AC 280 ms
96,096 KB
testcase_27 AC 333 ms
98,300 KB
testcase_28 AC 284 ms
96,804 KB
testcase_29 AC 366 ms
98,928 KB
testcase_30 AC 265 ms
96,656 KB
testcase_31 AC 259 ms
95,540 KB
testcase_32 AC 370 ms
99,580 KB
testcase_33 AC 280 ms
96,788 KB
testcase_34 AC 307 ms
98,024 KB
testcase_35 AC 341 ms
100,676 KB
testcase_36 AC 228 ms
94,296 KB
testcase_37 AC 274 ms
95,252 KB
testcase_38 AC 364 ms
99,276 KB
testcase_39 AC 322 ms
97,876 KB
testcase_40 AC 311 ms
98,792 KB
testcase_41 AC 228 ms
93,952 KB
testcase_42 AC 325 ms
99,708 KB
testcase_43 AC 349 ms
99,096 KB
testcase_44 AC 344 ms
100,488 KB
testcase_45 AC 375 ms
100,388 KB
testcase_46 AC 363 ms
100,432 KB
testcase_47 AC 394 ms
100,184 KB
testcase_48 AC 378 ms
100,188 KB
testcase_49 AC 323 ms
101,012 KB
testcase_50 AC 367 ms
100,172 KB
testcase_51 AC 355 ms
100,100 KB
testcase_52 AC 373 ms
100,256 KB
testcase_53 AC 391 ms
100,452 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys, re
from fractions import Fraction
from math import ceil, floor, sqrt, pi, factorial, gcd
from copy import deepcopy
from collections import Counter, deque, defaultdict
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement, permutations
from bisect import bisect, bisect_left, bisect_right
from functools import reduce
from decimal import Decimal, getcontext
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]
def lcm(a, b): return a * b // gcd(a, b)
def get_distance(x1, y1, x2, y2):
	  d = sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2)
	  return d
def rotate(table):
   	  n_fild = []
   	  for x in zip(*table[::-1]):
   	  	  n_fild.append(x)
   	  return n_fild
sys.setrecursionlimit(10 ** 7)
INF = float('inf')
MOD = 10 ** 9 + 7
MOD2 = 998244353


###関数コピーしたか?###
def main():
   
   n, d = i_map()
   A = [int(input()) for i in range(n)]
   sort_a = sorted(A)
   #print(sort_a)
   ans = [0] * n
   for i in range(n):
   	  num = A[i] - d
   	  if num <= 0:
   	  	  ans[i] = 0
   	  else:
   	  	  #print(num)
   	  	  ans[i] = bisect_right(sort_a, num) 
   #print(ans)
   for i in ans:
   	  print(i)
   
   
if __name__ == '__main__':
    main()


0