結果

問題 No.1110 好きな歌
ユーザー realDivineJKrealDivineJK
提出日時 2020-07-10 21:53:56
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 1,971 ms / 5,000 ms
コード長 526 bytes
コンパイル時間 299 ms
コンパイル使用メモリ 10,960 KB
実行使用メモリ 24,952 KB
最終ジャッジ日時 2023-08-01 17:43:04
合計ジャッジ時間 34,868 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
7,872 KB
testcase_01 AC 14 ms
7,796 KB
testcase_02 AC 14 ms
7,868 KB
testcase_03 AC 14 ms
7,916 KB
testcase_04 AC 14 ms
7,868 KB
testcase_05 AC 14 ms
7,804 KB
testcase_06 AC 14 ms
7,872 KB
testcase_07 AC 14 ms
7,800 KB
testcase_08 AC 14 ms
7,792 KB
testcase_09 AC 15 ms
7,852 KB
testcase_10 AC 15 ms
7,892 KB
testcase_11 AC 15 ms
7,804 KB
testcase_12 AC 15 ms
7,884 KB
testcase_13 AC 15 ms
7,828 KB
testcase_14 AC 16 ms
7,856 KB
testcase_15 AC 16 ms
7,792 KB
testcase_16 AC 17 ms
7,848 KB
testcase_17 AC 18 ms
8,228 KB
testcase_18 AC 14 ms
7,852 KB
testcase_19 AC 17 ms
8,284 KB
testcase_20 AC 19 ms
8,376 KB
testcase_21 AC 16 ms
7,812 KB
testcase_22 AC 17 ms
8,232 KB
testcase_23 AC 14 ms
7,852 KB
testcase_24 AC 915 ms
17,816 KB
testcase_25 AC 1,067 ms
20,052 KB
testcase_26 AC 683 ms
14,340 KB
testcase_27 AC 1,111 ms
20,060 KB
testcase_28 AC 522 ms
15,008 KB
testcase_29 AC 1,649 ms
21,860 KB
testcase_30 AC 356 ms
15,020 KB
testcase_31 AC 314 ms
12,308 KB
testcase_32 AC 1,636 ms
23,184 KB
testcase_33 AC 319 ms
16,092 KB
testcase_34 AC 759 ms
18,812 KB
testcase_35 AC 845 ms
24,708 KB
testcase_36 AC 87 ms
10,100 KB
testcase_37 AC 460 ms
12,804 KB
testcase_38 AC 1,633 ms
21,844 KB
testcase_39 AC 1,104 ms
18,408 KB
testcase_40 AC 634 ms
21,284 KB
testcase_41 AC 105 ms
9,196 KB
testcase_42 AC 944 ms
22,936 KB
testcase_43 AC 1,486 ms
21,604 KB
testcase_44 AC 1,047 ms
24,528 KB
testcase_45 AC 1,597 ms
24,540 KB
testcase_46 AC 1,386 ms
24,752 KB
testcase_47 AC 1,947 ms
24,584 KB
testcase_48 AC 1,503 ms
24,540 KB
testcase_49 AC 588 ms
24,952 KB
testcase_50 AC 1,464 ms
24,544 KB
testcase_51 AC 1,200 ms
24,540 KB
testcase_52 AC 1,503 ms
24,480 KB
testcase_53 AC 1,971 ms
24,840 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