結果

問題 No.1189 Sum is XOR
ユーザー kotatsugamekotatsugame
提出日時 2020-08-22 15:51:10
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 255 ms / 2,000 ms
コード長 425 bytes
コンパイル時間 593 ms
コンパイル使用メモリ 64,740 KB
実行使用メモリ 4,508 KB
最終ジャッジ日時 2023-08-05 12:54:08
合計ジャッジ時間 3,844 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 255 ms
4,388 KB
testcase_01 AC 163 ms
4,380 KB
testcase_02 AC 126 ms
4,380 KB
testcase_03 AC 2 ms
4,384 KB
testcase_04 AC 2 ms
4,384 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
4,384 KB
testcase_07 AC 2 ms
4,384 KB
testcase_08 AC 1 ms
4,384 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 38 ms
4,380 KB
testcase_12 AC 123 ms
4,380 KB
testcase_13 AC 215 ms
4,380 KB
testcase_14 AC 134 ms
4,380 KB
testcase_15 AC 58 ms
4,384 KB
testcase_16 AC 46 ms
4,380 KB
testcase_17 AC 41 ms
4,384 KB
testcase_18 AC 54 ms
4,508 KB
testcase_19 AC 179 ms
4,380 KB
testcase_20 AC 245 ms
4,384 KB
testcase_21 AC 2 ms
4,380 KB
testcase_22 AC 2 ms
4,384 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:6:1: 警告: ISO C++ では型の無い ‘main’ の宣言を禁止しています [-Wreturn-type]
    6 | main()
      | ^~~~

ソースコード

diff #

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