結果

問題 No.1189 Sum is XOR
ユーザー titiatitia
提出日時 2020-08-22 15:25:31
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,705 ms / 2,000 ms
コード長 486 bytes
コンパイル時間 266 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 28,592 KB
最終ジャッジ日時 2024-04-23 09:44:40
合計ジャッジ時間 16,453 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,145 ms
28,592 KB
testcase_01 AC 729 ms
28,452 KB
testcase_02 AC 576 ms
28,448 KB
testcase_03 AC 59 ms
19,032 KB
testcase_04 AC 55 ms
17,920 KB
testcase_05 AC 73 ms
22,888 KB
testcase_06 AC 96 ms
28,588 KB
testcase_07 AC 67 ms
20,472 KB
testcase_08 AC 40 ms
14,940 KB
testcase_09 AC 41 ms
14,976 KB
testcase_10 AC 37 ms
13,824 KB
testcase_11 AC 786 ms
14,208 KB
testcase_12 AC 547 ms
28,252 KB
testcase_13 AC 1,132 ms
25,480 KB
testcase_14 AC 1,473 ms
19,920 KB
testcase_15 AC 1,264 ms
13,824 KB
testcase_16 AC 1,480 ms
12,672 KB
testcase_17 AC 1,105 ms
13,952 KB
testcase_18 AC 670 ms
16,568 KB
testcase_19 AC 1,145 ms
23,152 KB
testcase_20 AC 1,705 ms
23,280 KB
testcase_21 AC 30 ms
10,624 KB
testcase_22 AC 27 ms
10,752 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
from collections import Counter

N,K=map(int,input().split())
A=list(map(int,input().split()))
C=Counter(A)

mod=998244353

if K>10:
    print(0)
    sys.exit()

DP=[[0]*(1<<10) for i in range(K+1)]
DP[0][0]=1

for c in C:
    for i in range(K):
        for j in range(1<<10):
            if c & j == 0 :
                DP[i+1][j|c]+=DP[i][j]*C[c]
                DP[i+1][j|c]%=mod

ANS=0
for i in range(1<<10):
    ANS+=DP[K][i]

print(ANS%mod)

0