結果
| 問題 |
No.2711 Connecting Lights
|
| コンテスト | |
| ユーザー |
nonon
|
| 提出日時 | 2024-03-31 13:44:28 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 96 ms / 5,000 ms |
| コード長 | 630 bytes |
| コンパイル時間 | 1,911 ms |
| コンパイル使用メモリ | 195,544 KB |
| 最終ジャッジ日時 | 2025-02-20 16:30:24 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 27 |
ソースコード
#include<bits/stdc++.h>
#include<atcoder/modint>
using namespace std;
using mint=atcoder::modint998244353;
int N,M,K;
mint dp[20202][32];
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
cin>>N>>M>>K;
if(M==1)
{
cout<<mint(2).pow(N).val()<<endl;
return 0;
}
dp[0][(1<<N)-1]=1;
for(int i=1;i<=M;i++)for(int j=0;j<(1<<N);j++)
{
for(int k=0;k<(1<<N);k++)
{
int both=(j&k);
if(__builtin_popcount(both)>=K)dp[i][k]+=dp[i-1][j];
}
}
mint ans=0;
for(int j=0;j<(1<<N);j++)ans+=dp[M][j];
cout<<ans.val()<<endl;
}
nonon