結果

問題 No.3128 Isosceles Triangle
ユーザー titia
提出日時 2025-04-25 22:21:26
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 427 ms / 2,500 ms
コード長 362 bytes
コンパイル時間 516 ms
コンパイル使用メモリ 82,844 KB
実行使用メモリ 173,924 KB
最終ジャッジ日時 2025-04-25 22:21:34
合計ジャッジ時間 7,898 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

from collections import Counter
from bisect import bisect_left

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

A.sort()

C=Counter(A)


ANS=0

for i in range(len(A)):
    if i>=1 and A[i]==A[i-1]:
        continue
    a=A[i]
    x=bisect_left(A,a*2)

    c=C[a]
    ANS+=c*(c-1)//2 * (x-c)

    #print(a,ANS)

print(ANS)
0