結果

問題 No.2711 Connecting Lights
ユーザー kotatsugamekotatsugame
提出日時 2024-03-31 13:45:21
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 93 ms / 5,000 ms
コード長 565 bytes
コンパイル時間 521 ms
コンパイル使用メモリ 67,352 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-03-31 13:45:28
合計ジャッジ時間 2,065 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,676 KB
testcase_01 AC 2 ms
6,676 KB
testcase_02 AC 2 ms
6,676 KB
testcase_03 AC 2 ms
6,676 KB
testcase_04 AC 1 ms
6,676 KB
testcase_05 AC 2 ms
6,676 KB
testcase_06 AC 2 ms
6,676 KB
testcase_07 AC 2 ms
6,676 KB
testcase_08 AC 3 ms
6,676 KB
testcase_09 AC 55 ms
6,676 KB
testcase_10 AC 39 ms
6,676 KB
testcase_11 AC 74 ms
6,676 KB
testcase_12 AC 17 ms
6,676 KB
testcase_13 AC 20 ms
6,676 KB
testcase_14 AC 3 ms
6,676 KB
testcase_15 AC 11 ms
6,676 KB
testcase_16 AC 3 ms
6,676 KB
testcase_17 AC 3 ms
6,676 KB
testcase_18 AC 4 ms
6,676 KB
testcase_19 AC 56 ms
6,676 KB
testcase_20 AC 22 ms
6,676 KB
testcase_21 AC 3 ms
6,676 KB
testcase_22 AC 2 ms
6,676 KB
testcase_23 AC 2 ms
6,676 KB
testcase_24 AC 35 ms
6,676 KB
testcase_25 AC 42 ms
6,676 KB
testcase_26 AC 92 ms
6,676 KB
testcase_27 AC 87 ms
6,676 KB
testcase_28 AC 93 ms
6,676 KB
testcase_29 AC 83 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<cassert>
#include<atcoder/modint>
using namespace std;
using mint=atcoder::modint998244353;
int N,M,K;
mint dp[2][1<<5];
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cin>>N>>M>>K;
	int now=0;
	for(int i=0;i<1<<N;i++)dp[now][i]=1;
	for(int j=1;j<M;j++)
	{
		int nxt=1-now;
		for(int i=0;i<1<<N;i++)dp[nxt][i]=0;
		for(int i=0;i<1<<N;i++)
		{
			for(int k=0;k<1<<N;k++)if(__builtin_popcount(i&k)>=K)dp[nxt][k]+=dp[now][i];
		}
		now=nxt;
	}
	mint ans=0;
	for(int i=0;i<1<<N;i++)ans+=dp[now][i];
	cout<<ans.val()<<endl;
}
0