結果
問題 |
No.3128 Isosceles Triangle
|
ユーザー |
👑 ![]() |
提出日時 | 2025-04-25 21:43:48 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 960 ms / 2,500 ms |
コード長 | 399 bytes |
コンパイル時間 | 533 ms |
コンパイル使用メモリ | 82,548 KB |
実行使用メモリ | 176,408 KB |
最終ジャッジ日時 | 2025-04-25 21:44:28 |
合計ジャッジ時間 | 10,894 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 30 |
ソースコード
N = int(input()) A = list(map(int,input().split())) dic = {} for a in A: if a not in dic: dic[a] = 0 dic[a] += 1 ac = [ (na,dic[na]) for na in dic ] ac.sort() lgidx = 0 lg = 0 ans = 0 for na,cnt in ac: while lgidx < len(ac) and ac[lgidx][0] < na*2: lg += ac[lgidx][1] lgidx += 1 other = lg - cnt ans += (cnt * (cnt-1) // 2) * other print (ans)