結果

問題 No.3128 Isosceles Triangle
ユーザー ゼット
提出日時 2025-04-25 21:35:44
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 381 ms / 2,500 ms
コード長 296 bytes
コンパイル時間 347 ms
コンパイル使用メモリ 82,240 KB
実行使用メモリ 167,152 KB
最終ジャッジ日時 2025-04-25 21:36:17
合計ジャッジ時間 6,866 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
A=list(map(int,input().split()))
from bisect import bisect_right
A.sort()
result=0
T={}
for i in range(N):
  x=A[i]
  if not x in T:
    T[x]=1
  else:
    T[x]+=1
for x in T:
  n=T[x]
  count=n*(n-1)//2
  pos1=bisect_right(A,2*x-1)
  ans=(pos1-n)*count
  result+=ans
print(result)
0