結果

問題 No.1904 Never giving up!
ユーザー 👑 rin204rin204
提出日時 2022-04-15 21:23:57
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 403 bytes
コンパイル時間 296 ms
コンパイル使用メモリ 87,268 KB
実行使用メモリ 93,540 KB
最終ジャッジ日時 2023-08-26 07:27:22
合計ジャッジ時間 3,413 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 66 ms
71,460 KB
testcase_01 AC 65 ms
71,260 KB
testcase_02 WA -
testcase_03 AC 63 ms
71,128 KB
testcase_04 WA -
testcase_05 AC 439 ms
93,188 KB
testcase_06 WA -
testcase_07 AC 65 ms
71,372 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
A = list(map(int, input().split()))
cnt = 0
dp = [0] * (1 << n)
max_ = [0] * (1 << n)
dp[0] = 1
for bit in range(1, 1 << n):
    for i in range(n):
        if bit >> i & 1:
            bbit = bit ^ (1 << i)
            if A[i] >= max_[bbit]:
                max_[bbit] = A[i]
                dp[bit] += dp[bbit]
x = dp[-1]
ans = 1
for i in range(1, n + 1):
    ans *= i
print(ans // x)
0