結果
| 問題 | No.1189 Sum is XOR |
| コンテスト | |
| ユーザー |
37zigen
|
| 提出日時 | 2020-08-26 21:15:12 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 75 ms / 2,000 ms |
| コード長 | 450 bytes |
| 記録 | |
| コンパイル時間 | 250 ms |
| コンパイル使用メモリ | 85,744 KB |
| 実行使用メモリ | 110,712 KB |
| 最終ジャッジ日時 | 2026-05-07 21:51:08 |
| 合計ジャッジ時間 | 2,527 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 21 |
ソースコード
import collections
MOD=998244353
N,K=map(int,input().split())
A=collections.Counter(list(map(int,input().split())))
if K>10:
exit(print(0))
dp=[[0]*11 for _ in range(1<<10)]
dp[0][0]=1
for a in A:
s=(~a)&((1<<10)-1)
while True:
for i in range(10):
dp[a|s][i+1]=(dp[a|s][i+1]+dp[s][i]*A[a])%MOD
if s==0:
break
s=(s-1)&(~a)
ans=0
for i in range(1,1<<10):
ans=(ans+dp[i][K])%MOD
print(ans)
37zigen