結果

問題 No.1882 Areas of Triangle
ユーザー 👑 KazunKazun
提出日時 2022-03-22 20:04:35
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 125 ms / 2,000 ms
コード長 761 bytes
コンパイル時間 338 ms
コンパイル使用メモリ 82,944 KB
実行使用メモリ 90,984 KB
最終ジャッジ日時 2024-04-18 20:16:58
合計ジャッジ時間 3,057 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
51,712 KB
testcase_01 AC 37 ms
52,224 KB
testcase_02 AC 37 ms
52,364 KB
testcase_03 AC 39 ms
52,224 KB
testcase_04 AC 122 ms
89,344 KB
testcase_05 AC 125 ms
90,984 KB
testcase_06 AC 85 ms
90,968 KB
testcase_07 AC 39 ms
52,224 KB
testcase_08 AC 38 ms
51,712 KB
testcase_09 AC 38 ms
52,208 KB
testcase_10 AC 36 ms
52,224 KB
testcase_11 AC 37 ms
51,712 KB
testcase_12 AC 38 ms
51,712 KB
testcase_13 AC 38 ms
52,216 KB
testcase_14 AC 37 ms
52,224 KB
testcase_15 AC 36 ms
52,608 KB
testcase_16 AC 47 ms
59,776 KB
testcase_17 AC 51 ms
63,744 KB
testcase_18 AC 53 ms
65,408 KB
testcase_19 AC 56 ms
72,064 KB
testcase_20 AC 59 ms
71,424 KB
testcase_21 AC 54 ms
70,784 KB
testcase_22 AC 58 ms
72,960 KB
testcase_23 AC 75 ms
78,452 KB
testcase_24 AC 73 ms
78,572 KB
testcase_25 AC 37 ms
51,840 KB
testcase_26 AC 38 ms
52,352 KB
testcase_27 AC 37 ms
52,480 KB
testcase_28 AC 47 ms
52,480 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def Binary_Search_Big_Count(A,x,equal=False,sort=False):
    """2分探索によって,xを超える要素の個数を調べる.

    A:リスト
    x:調べる要素
    sort:ソートをする必要があるかどうか(Trueで必要)
    equal:Trueのときはx"を超える"がx"以上"になる
    """

    if sort: A.sort()

    if len(A)==0 or A[-1]<x or ((not equal) and A[-1]==x):
        return 0

    L,R=-1,len(A)-1
    while R-L>1:
        C=L+(R-L)//2
        if A[C]>x or (equal and A[C]==x): R=C
        else: L=C
    return len(A)-R

#==================================================
N,K=map(int,input().split())
A=list(map(int,input().split()))
A.sort()

X=0
for a in A:
    X+=Binary_Search_Big_Count(A,(2*K+a-1)//a,True,False)

print(X)
0