結果

問題 No.1882 Areas of Triangle
ユーザー tobusakana
提出日時 2022-12-12 00:55:17
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 93 ms / 2,000 ms
コード長 407 bytes
コンパイル時間 249 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 86,656 KB
最終ジャッジ日時 2024-10-15 19:53:19
合計ジャッジ時間 2,783 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 5
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

N,K = map(int,input().split())
A = list(map(int,input().split()))
K *= 2

A = sorted(A)
ans = 0
for i in range(N):
  # A[i] * A[j]がK以上である
  if A[i] * A[-1] < K:
    continue
  if A[i] * A[0] >= K:
    ans += N
    continue
  ng = 0
  ok = N
  while abs(ng - ok) > 1:
    mid = abs(ng + ok) // 2
    if A[i] * A[mid] >= K:
      ok = mid
    else:
      ng = mid
  ans += N - (ng + 1)

print(ans)
0