結果
| 問題 |
No.2711 Connecting Lights
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-03-31 14:28:39 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 89 ms / 5,000 ms |
| コード長 | 573 bytes |
| コンパイル時間 | 1,618 ms |
| コンパイル使用メモリ | 195,404 KB |
| 最終ジャッジ日時 | 2025-02-20 17:14:55 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 27 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
constexpr int MOD=998244353;
void ch(ll &a,ll b){
a=(a+b)%MOD;
}
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int N,M,K;
cin>>N>>M>>K;
vector dp0(1<<N,1ll),dp1(1<<N,0ll);
for(int i=1;i<M;i++){
for(int j=0;j<1<<N;j++){
for(int k=0;k<1<<N;k++){
if(__builtin_popcount(j&k)>=K){
ch(dp1[k],dp0[j]);
}
}
}
for(int j=0;j<1<<N;j++){
dp0[j]=dp1[j];
dp1[j]=0;
}
}
ll ans=0;
for(ll i:dp0)ch(ans,i);
cout<<ans<<'\n';
}