結果

問題 No.1189 Sum is XOR
ユーザー kotatsugame
提出日時 2020-08-22 15:56:34
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 510 bytes
コンパイル時間 621 ms
コンパイル使用メモリ 65,204 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-15 10:05:33
合計ジャッジ時間 1,998 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 9 WA * 12
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:7:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    7 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
using namespace std;
int N,K;
long dp[11][1<<10];
long cnt[1<<10];
const int mod=998244353;
main()
{
	cin>>N>>K;
	if(K>10)
	{
		cout<<0<<endl;
		return 0;
	}
	for(int i=0;i<N;i++)
	{
		int A;cin>>A;
		cnt[A]++;
	}
	dp[0][0]=1;
	for(int k=0;k<K;k++)
	{
		for(int i=0;i<1<<10;i++)
		{
			int T=1023&~i;
			int lim=T&-T;
			for(int j=T;j>0;j=j-1&T)
			{
				if(j&lim)(dp[k+1][i|j]+=dp[k][i]*cnt[j])%=mod;
			}
		}
	}
	long ans=0;
	for(int i=0;i<1<<10;i++)ans+=dp[K][i];
	cout<<ans%mod<<endl;
}
0