結果

問題 No.3128 Isosceles Triangle
ユーザー 三価スニウム
提出日時 2025-06-25 02:28:01
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 266 ms / 2,500 ms
コード長 285 bytes
コンパイル時間 434 ms
コンパイル使用メモリ 82,336 KB
実行使用メモリ 133,700 KB
最終ジャッジ日時 2025-06-25 02:28:09
合計ジャッジ時間 7,913 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

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

from itertools import groupby
import bisect

ans = 0
A.sort()
for k, g in groupby(A):
    n = len(list(g))
    if n < 2:
        continue
    s = n * (n-1) // 2
    t = bisect.bisect_right(A, 2*k-1) - n
    ans += s * t

print(ans)
0