結果

問題 No.1904 Never giving up!
ユーザー donutholedonuthole
提出日時 2022-04-15 21:53:56
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 442 ms / 2,000 ms
コード長 1,647 bytes
コンパイル時間 1,053 ms
コンパイル使用メモリ 86,920 KB
実行使用メモリ 109,916 KB
最終ジャッジ日時 2023-08-26 07:50:59
合計ジャッジ時間 8,393 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 431 ms
109,904 KB
testcase_01 AC 431 ms
109,904 KB
testcase_02 AC 435 ms
109,516 KB
testcase_03 AC 426 ms
109,856 KB
testcase_04 AC 427 ms
109,780 KB
testcase_05 AC 440 ms
109,604 KB
testcase_06 AC 427 ms
109,916 KB
testcase_07 AC 436 ms
109,556 KB
testcase_08 AC 437 ms
109,736 KB
testcase_09 AC 442 ms
109,816 KB
testcase_10 AC 427 ms
109,760 KB
testcase_11 AC 432 ms
109,600 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# region template
from typing import Generic, Iterable, Iterator, TypeVar, Union, List
from bisect import bisect_left, bisect_right
from bisect import bisect_left, bisect_right, insort
from email.policy import default
import re
import typing
import math
import sys
import copy
import itertools
import collections
import bisect
import heapq
import decimal
import random
import gc


def ni(): return int(sys.stdin.readline())
def ns(): return map(int, sys.stdin.readline().split())
def ns1(): return map(lambda x: int(x)-1, sys.stdin.readline().split())
def na(): return list(map(int, sys.stdin.readline().split()))
def na1(): return list(map(lambda x: int(x)-1, sys.stdin.readline().split()))
def nall(): return list(map(int, sys.stdin.read().split()))
def flush(): return sys.stdout.flush()
def nib(): return int(sys.stdin.buffer.readline())
def nsb(): return map(int, sys.stdin.buffer.readline().split())
def ns1b(): return map(lambda x: int(x)-1, sys.stdin.buffer.readline().split())
def nab(): return list(map(int, sys.stdin.buffer.readline().split()))
def na1b(): return list(map(lambda x: int(x)-1, sys.stdin.buffer.readline().split()))
def nallb(): return list(map(int, sys.stdin.buffer.read().split()))
# limregion


# sys.setrecursionlimit(10**7+1)
inf = 10**20
# mod = 10**9+7
mod = 998244353


def main():
    N = ni()
    A = na()
    cnt = collections.Counter(A)
    l = [[k, v] for k, v in cnt.items()]

    perm = [0,1]
    for i in range(2, 25):
        perm.append(perm[-1]*i)
    bunshi, bunbo = 1, perm[N]

    for k, v in l:
        bunshi *= perm[v]

    print((bunbo+bunshi-1)//bunshi)


if __name__ == '__main__':
    main()
0