結果

問題 No.3128 Isosceles Triangle
ユーザー detteiuu
提出日時 2025-04-25 21:43:41
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 319 ms / 2,500 ms
コード長 352 bytes
コンパイル時間 573 ms
コンパイル使用メモリ 82,644 KB
実行使用メモリ 176,492 KB
最終ジャッジ日時 2025-04-25 21:43:49
合計ジャッジ時間 7,491 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
from bisect import bisect_left, bisect_right
from math import comb

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

D = defaultdict(int)
for a in A:
    D[a] += 1

ans = 0
for n, c in D.items():
    if c == 1:
        continue
    a = comb(c, 2)
    b = bisect_left(A, 2*n)-c
    ans += a*b

print(ans)
0