結果

問題 No.1904 Never giving up!
コンテスト
ユーザー lam6er
提出日時 2025-03-20 20:27:33
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 64 ms / 2,000 ms
コード長 446 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 239 ms
コンパイル使用メモリ 95,724 KB
実行使用メモリ 82,816 KB
最終ジャッジ日時 2026-07-07 09:16:28
合計ジャッジ時間 2,249 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 9
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import math

n = int(input())
A = list(map(int, input().split()))
A.sort()

group_counts = []
current = A[0]
count = 1

for num in A[1:]:
    if num == current:
        count += 1
    else:
        group_counts.append(count)
        current = num
        count = 1
group_counts.append(count)  # Add the last group

product = 1
for c in group_counts:
    product *= math.factorial(c)

n_fact = math.factorial(n)
ans = n_fact // product

print(ans)
0