結果

問題 No.2711 Connecting Lights
ユーザー umezoumezo
提出日時 2024-03-31 14:53:57
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 123 ms / 5,000 ms
コード長 697 bytes
コンパイル時間 2,417 ms
コンパイル使用メモリ 243,612 KB
実行使用メモリ 8,448 KB
最終ジャッジ日時 2024-09-30 20:04:32
合計ジャッジ時間 4,134 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
template <class T> using V=vector<T>;
template <class T> using VV=V<V<T>>; //B(n,V<int>(n))

ll dp[20020][32];
const int MOD=998244353;
 
int main(){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  
  ll n,m,K;
  cin>>n>>m>>K;
  rep(j,1<<n) dp[0][j]=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 c=__builtin_popcount(k&j);
        if(c>=K) dp[i][k]=(dp[i][k]+dp[i-1][j])%MOD;
      }
    }
  }
  ll ans=0;
  rep(j,1<<n) ans=(ans+dp[m-1][j])%MOD;
  cout<<ans<<endl;
    
  return 0;
}
0