提出 #54171023


ソースコード 拡げる

m, n = map(int, input().split())
x = list(map(int, input().split()))
num = [0]*m
for i in range(m):
    num[x[i]-1] |= 1<<i
mod = 998244353

dp = [0]*(1<<m)
dp[-1] = 1
for _ in range(n):
    dp2 = [0]*(1<<m)
    for i in range(1<<m):
        for j in range(m):
            if i>>j&1:
                dp2[i^(1<<j)|num[j]] += dp[i]
                dp2[i^(1<<j)|num[j]] %= mod
    dp = dp2
print(sum(dp)%mod)

提出情報

提出日時
問題 B - Between B and B
ユーザ noriaoki
言語 Python (PyPy 3.10-v7.3.12)
得点 500
コード長 422 Byte
結果 AC
実行時間 853 ms
メモリ 83036 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 500 / 500
結果
AC × 3
AC × 32
セット名 テストケース
Sample 00-sample-001.txt, 00-sample-002.txt, 00-sample-003.txt
All 00-sample-001.txt, 00-sample-002.txt, 00-sample-003.txt, 01-handmade-001.txt, 01-handmade-002.txt, 01-handmade-003.txt, 01-handmade-004.txt, 01-handmade-005.txt, 01-handmade-006.txt, 01-handmade-007.txt, 01-handmade-008.txt, 01-handmade-009.txt, 02-random-001.txt, 02-random-002.txt, 02-random-003.txt, 02-random-004.txt, 02-random-005.txt, 02-random-006.txt, 02-random-007.txt, 02-random-008.txt, 02-random-009.txt, 02-random-010.txt, 02-random-011.txt, 02-random-012.txt, 02-random-013.txt, 02-random-014.txt, 02-random-015.txt, 02-random-016.txt, 02-random-017.txt, 02-random-018.txt, 02-random-019.txt, 02-random-020.txt
ケース名 結果 実行時間 メモリ
00-sample-001.txt AC 55 ms 76160 KiB
00-sample-002.txt AC 55 ms 76632 KiB
00-sample-003.txt AC 55 ms 76484 KiB
01-handmade-001.txt AC 55 ms 76456 KiB
01-handmade-002.txt AC 61 ms 82152 KiB
01-handmade-003.txt AC 850 ms 82936 KiB
01-handmade-004.txt AC 846 ms 82748 KiB
01-handmade-005.txt AC 848 ms 82696 KiB
01-handmade-006.txt AC 853 ms 82768 KiB
01-handmade-007.txt AC 850 ms 82848 KiB
01-handmade-008.txt AC 853 ms 83036 KiB
01-handmade-009.txt AC 60 ms 81564 KiB
02-random-001.txt AC 56 ms 76512 KiB
02-random-002.txt AC 60 ms 81648 KiB
02-random-003.txt AC 60 ms 81604 KiB
02-random-004.txt AC 55 ms 76324 KiB
02-random-005.txt AC 60 ms 81532 KiB
02-random-006.txt AC 60 ms 81444 KiB
02-random-007.txt AC 60 ms 81704 KiB
02-random-008.txt AC 71 ms 81756 KiB
02-random-009.txt AC 65 ms 81756 KiB
02-random-010.txt AC 56 ms 76292 KiB
02-random-011.txt AC 60 ms 81628 KiB
02-random-012.txt AC 60 ms 81924 KiB
02-random-013.txt AC 341 ms 82568 KiB
02-random-014.txt AC 118 ms 82976 KiB
02-random-015.txt AC 61 ms 81752 KiB
02-random-016.txt AC 117 ms 82556 KiB
02-random-017.txt AC 63 ms 81844 KiB
02-random-018.txt AC 64 ms 81968 KiB
02-random-019.txt AC 70 ms 81688 KiB
02-random-020.txt AC 61 ms 82004 KiB