結果

問題 No.1189 Sum is XOR
ユーザー lloyzlloyz
提出日時 2023-10-29 02:11:16
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 103 ms / 2,000 ms
コード長 578 bytes
コンパイル時間 358 ms
コンパイル使用メモリ 81,832 KB
実行使用メモリ 104,744 KB
最終ジャッジ日時 2023-10-29 02:11:19
合計ジャッジ時間 3,174 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 101 ms
104,744 KB
testcase_01 AC 103 ms
104,744 KB
testcase_02 AC 101 ms
104,744 KB
testcase_03 AC 57 ms
78,812 KB
testcase_04 AC 53 ms
74,984 KB
testcase_05 AC 64 ms
87,492 KB
testcase_06 AC 75 ms
99,020 KB
testcase_07 AC 59 ms
80,812 KB
testcase_08 AC 47 ms
68,168 KB
testcase_09 AC 49 ms
68,932 KB
testcase_10 AC 46 ms
64,716 KB
testcase_11 AC 66 ms
72,348 KB
testcase_12 AC 99 ms
104,696 KB
testcase_13 AC 93 ms
99,184 KB
testcase_14 AC 80 ms
87,716 KB
testcase_15 AC 70 ms
72,360 KB
testcase_16 AC 73 ms
69,560 KB
testcase_17 AC 67 ms
71,720 KB
testcase_18 AC 69 ms
79,148 KB
testcase_19 AC 91 ms
92,496 KB
testcase_20 AC 91 ms
92,564 KB
testcase_21 AC 49 ms
62,132 KB
testcase_22 AC 49 ms
62,132 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

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

DP = [[0 for _ in range(k + 1)] for _ in range(1 << 10)]
for i in range(n):
    DP[A[i]][1] += 1
for i in range(2, k + 1):
    for bit1 in range(1 << 10):
        for bit2 in range(bit1, 1 << 10):
            if bit1 ^ bit2 == bit1 | bit2:
                nbit = bit1 | bit2
                DP[nbit][i] += DP[bit1][i - 1] * DP[bit2][1] % mod
                DP[nbit][i] %= mod
ans = 0
for i in range(1 << 10):
    ans += DP[i][k]
    ans %= mod
print(ans)
0