結果

問題 No.1631 Sorting Integers (Multiple of K) Easy
ユーザー PSL24251284PSL24251284
提出日時 2021-07-31 03:27:55
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 451 bytes
コンパイル時間 303 ms
コンパイル使用メモリ 86,724 KB
実行使用メモリ 206,248 KB
最終ジャッジ日時 2023-10-14 12:17:17
合計ジャッジ時間 51,983 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,080 KB
testcase_01 WA -
testcase_02 AC 72 ms
71,044 KB
testcase_03 AC 98 ms
76,608 KB
testcase_04 AC 70 ms
71,080 KB
testcase_05 AC 72 ms
71,044 KB
testcase_06 WA -
testcase_07 AC 73 ms
71,276 KB
testcase_08 AC 83 ms
76,316 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 83 ms
76,552 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 TLE -
testcase_15 TLE -
testcase_16 TLE -
testcase_17 TLE -
testcase_18 TLE -
testcase_19 TLE -
testcase_20 TLE -
testcase_21 AC 2,999 ms
190,348 KB
testcase_22 TLE -
testcase_23 TLE -
testcase_24 TLE -
testcase_25 TLE -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

N,K = map(int,input().split())
c = [0] + list(map(int,input().split()))
S = []
for i in range(10):
    for j in range(c[i]):
        S.append(i)

dp = [[0]*K for i in range(1<<N)]
dp[0][0] = 1
for bit in range(1,1<<N):
    n = -1
    for i in range(N):
        if (bit>>i)&1:
            n += 1
    for k in range(K):
        for i in range(N):
            if (bit>>i)&1:
                dp[bit][k] += dp[bit^(1<<i)][(k-S[n]*10**i)%K]
print(dp[-1][0])
0