結果

問題 No.1189 Sum is XOR
ユーザー qumazakiqumazaki
提出日時 2020-09-12 03:15:14
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 131 ms / 2,000 ms
コード長 465 bytes
コンパイル時間 236 ms
コンパイル使用メモリ 86,956 KB
実行使用メモリ 106,012 KB
最終ジャッジ日時 2023-08-28 15:18:54
合計ジャッジ時間 4,586 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 131 ms
105,896 KB
testcase_01 AC 123 ms
105,868 KB
testcase_02 AC 126 ms
106,012 KB
testcase_03 AC 85 ms
88,980 KB
testcase_04 AC 82 ms
86,904 KB
testcase_05 AC 89 ms
95,360 KB
testcase_06 AC 101 ms
104,996 KB
testcase_07 AC 87 ms
90,684 KB
testcase_08 AC 75 ms
80,012 KB
testcase_09 AC 76 ms
80,844 KB
testcase_10 AC 74 ms
78,708 KB
testcase_11 AC 99 ms
80,292 KB
testcase_12 AC 120 ms
105,976 KB
testcase_13 AC 125 ms
102,436 KB
testcase_14 AC 112 ms
91,676 KB
testcase_15 AC 104 ms
80,372 KB
testcase_16 AC 108 ms
77,576 KB
testcase_17 AC 99 ms
79,604 KB
testcase_18 AC 102 ms
85,148 KB
testcase_19 AC 120 ms
96,392 KB
testcase_20 AC 125 ms
96,668 KB
testcase_21 AC 86 ms
76,460 KB
testcase_22 AC 84 ms
76,620 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,k = map(int,input().split())
a = list(map(int,input().split()))
mod = 998244353

if(k > 10):
    print(0)
    exit()

cnt = [0] * (2**10)
for ai in a:
    cnt[ai] += 1

dp = [[0] * (2**10) for _ in range(k+1)]
dp[0][0] = 1

for ci in range(2**10):
    for i in range(k):
        for j in range(2**10):        
            if(j & ci)==0:
                dp[i+1][j | ci] += dp[i][j] * cnt[ci]
                dp[i+1][j | ci] %= mod

ans = sum(dp[-1])%mod
print(ans)
0