結果

問題 No.1110 好きな歌
ユーザー realDivineJKrealDivineJK
提出日時 2020-07-10 21:53:56
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 2,175 ms / 5,000 ms
コード長 526 bytes
コンパイル時間 147 ms
コンパイル使用メモリ 12,928 KB
実行使用メモリ 27,708 KB
最終ジャッジ日時 2024-04-19 16:55:32
合計ジャッジ時間 37,766 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,752 KB
testcase_01 AC 25 ms
10,880 KB
testcase_02 AC 25 ms
10,880 KB
testcase_03 AC 25 ms
10,752 KB
testcase_04 AC 26 ms
10,880 KB
testcase_05 AC 26 ms
10,880 KB
testcase_06 AC 26 ms
10,752 KB
testcase_07 AC 26 ms
10,752 KB
testcase_08 AC 25 ms
10,752 KB
testcase_09 AC 25 ms
10,880 KB
testcase_10 AC 24 ms
10,752 KB
testcase_11 AC 26 ms
10,880 KB
testcase_12 AC 25 ms
10,752 KB
testcase_13 AC 25 ms
10,880 KB
testcase_14 AC 28 ms
10,752 KB
testcase_15 AC 27 ms
10,752 KB
testcase_16 AC 27 ms
10,880 KB
testcase_17 AC 29 ms
11,008 KB
testcase_18 AC 26 ms
10,752 KB
testcase_19 AC 30 ms
10,880 KB
testcase_20 AC 29 ms
10,880 KB
testcase_21 AC 28 ms
10,752 KB
testcase_22 AC 30 ms
10,752 KB
testcase_23 AC 27 ms
10,752 KB
testcase_24 AC 988 ms
20,576 KB
testcase_25 AC 1,199 ms
22,820 KB
testcase_26 AC 756 ms
17,024 KB
testcase_27 AC 1,245 ms
22,656 KB
testcase_28 AC 614 ms
17,652 KB
testcase_29 AC 1,716 ms
24,588 KB
testcase_30 AC 399 ms
17,656 KB
testcase_31 AC 373 ms
14,976 KB
testcase_32 AC 1,822 ms
25,924 KB
testcase_33 AC 389 ms
18,776 KB
testcase_34 AC 867 ms
21,448 KB
testcase_35 AC 964 ms
27,708 KB
testcase_36 AC 113 ms
12,672 KB
testcase_37 AC 536 ms
15,360 KB
testcase_38 AC 1,691 ms
24,392 KB
testcase_39 AC 1,285 ms
21,080 KB
testcase_40 AC 708 ms
23,864 KB
testcase_41 AC 121 ms
11,776 KB
testcase_42 AC 1,060 ms
25,644 KB
testcase_43 AC 1,635 ms
24,240 KB
testcase_44 AC 1,239 ms
27,424 KB
testcase_45 AC 1,746 ms
27,420 KB
testcase_46 AC 1,557 ms
27,612 KB
testcase_47 AC 2,175 ms
27,428 KB
testcase_48 AC 1,645 ms
27,428 KB
testcase_49 AC 728 ms
27,680 KB
testcase_50 AC 1,665 ms
27,280 KB
testcase_51 AC 1,394 ms
27,424 KB
testcase_52 AC 1,664 ms
27,356 KB
testcase_53 AC 2,102 ms
27,612 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, D = map(int, input().split())
A = [int(input()) for _ in range(N)]
B = [A[i] + D for i in range(N)]
B.sort()
cnt = 1
tmp = N
while tmp:
    cnt += 1
    tmp >>= 1
for i in range(N):
    if A[i] < B[0]:
        print(0)
    elif A[i] >= B[-1]:
        print(N)
    else:
        l, r = 0, N
        d = (l + r) // 2
        for j in range(cnt+1):
            if A[i] >= B[d]:
                l = d
                d = (l + r) // 2
            else:
                r = d
                d = (l + r) // 2
        print(d + 1)
0