結果

問題 No.3128 Isosceles Triangle
コンテスト
ユーザー urunea
提出日時 2025-05-01 04:20:08
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 479 ms / 2,500 ms
コード長 373 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 390 ms
コンパイル使用メモリ 95,976 KB
実行使用メモリ 244,736 KB
最終ジャッジ日時 2026-07-10 09:58:41
合計ジャッジ時間 8,585 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

from itertools import accumulate
from collections import Counter
import math
import bisect

N=int(input())
A=list(map(int, input().split()))
C=Counter(A)
A=sorted(set(A))
mem=[]
for i in A:
    mem.append(C[i])

mem=list(accumulate(mem))

ans=0
for i in range(len(A)):
    idx = bisect.bisect_left(A, A[i]*2)
    ans += math.comb(C[A[i]],2)*(mem[idx-1]-C[A[i]])

print(ans)
0