結果

問題 No.411 昇順昇順ソート
ユーザー convexineqconvexineq
提出日時 2021-02-03 03:43:57
言語 PyPy3
(7.3.13)
結果
MLE  
実行時間 -
コード長 508 bytes
コンパイル時間 346 ms
コンパイル使用メモリ 87,328 KB
実行使用メモリ 573,496 KB
最終ジャッジ日時 2023-09-12 11:44:56
合計ジャッジ時間 6,978 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
80,160 KB
testcase_01 AC 77 ms
75,600 KB
testcase_02 AC 76 ms
75,844 KB
testcase_03 AC 78 ms
75,744 KB
testcase_04 AC 78 ms
75,908 KB
testcase_05 AC 78 ms
75,588 KB
testcase_06 AC 78 ms
75,652 KB
testcase_07 AC 78 ms
75,744 KB
testcase_08 AC 79 ms
75,964 KB
testcase_09 AC 75 ms
75,728 KB
testcase_10 AC 76 ms
75,688 KB
testcase_11 AC 75 ms
75,716 KB
testcase_12 AC 75 ms
75,900 KB
testcase_13 AC 76 ms
75,696 KB
testcase_14 AC 77 ms
75,700 KB
testcase_15 AC 76 ms
75,968 KB
testcase_16 AC 76 ms
75,900 KB
testcase_17 AC 77 ms
75,688 KB
testcase_18 AC 78 ms
75,568 KB
testcase_19 AC 76 ms
75,652 KB
testcase_20 AC 73 ms
71,120 KB
testcase_21 AC 72 ms
71,316 KB
testcase_22 AC 73 ms
71,120 KB
testcase_23 AC 73 ms
71,200 KB
testcase_24 AC 74 ms
71,224 KB
testcase_25 AC 74 ms
70,972 KB
testcase_26 AC 74 ms
71,156 KB
testcase_27 AC 117 ms
83,208 KB
testcase_28 MLE -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

n,k = map(int,input().split())
N = 1<<n
dp0 = [[0]*n for _ in range(N)]
dp1 = [[0]*n for _ in range(N)]
dp0[1<<(k-1)][k-1] = 1
for mask in range(1<<n):
    for i in range(n):
        if dp0[mask][i] == dp1[mask][i] == 0: continue
        for j in range(n):
            if mask>>j&1: continue
            if i < j:
                dp0[mask|(1<<j)][j] += dp0[mask][i]
                dp1[mask|(1<<j)][j] += dp1[mask][i]
            else:
                dp1[mask|(1<<j)][j] += dp0[mask][i]
print(sum(dp1[N-1]))
0