結果

問題 No.2711 Connecting Lights
ユーザー BBhorseBBhorse
提出日時 2024-03-31 15:17:33
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1,755 ms / 5,000 ms
コード長 926 bytes
コンパイル時間 1,453 ms
コンパイル使用メモリ 168,304 KB
実行使用メモリ 9,052 KB
最終ジャッジ日時 2024-03-31 15:17:57
合計ジャッジ時間 15,784 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
9,052 KB
testcase_01 AC 3 ms
9,052 KB
testcase_02 AC 4 ms
9,052 KB
testcase_03 AC 3 ms
9,052 KB
testcase_04 AC 3 ms
9,052 KB
testcase_05 AC 11 ms
9,052 KB
testcase_06 AC 6 ms
9,052 KB
testcase_07 AC 5 ms
9,052 KB
testcase_08 AC 16 ms
9,052 KB
testcase_09 AC 1,030 ms
9,052 KB
testcase_10 AC 769 ms
9,052 KB
testcase_11 AC 1,366 ms
9,052 KB
testcase_12 AC 232 ms
9,052 KB
testcase_13 AC 272 ms
9,052 KB
testcase_14 AC 22 ms
9,052 KB
testcase_15 AC 154 ms
9,052 KB
testcase_16 AC 11 ms
9,052 KB
testcase_17 AC 13 ms
9,052 KB
testcase_18 AC 31 ms
9,052 KB
testcase_19 AC 1,104 ms
9,052 KB
testcase_20 AC 294 ms
9,052 KB
testcase_21 AC 12 ms
9,052 KB
testcase_22 AC 5 ms
9,052 KB
testcase_23 AC 5 ms
9,052 KB
testcase_24 AC 606 ms
9,052 KB
testcase_25 AC 793 ms
9,052 KB
testcase_26 AC 1,755 ms
9,052 KB
testcase_27 AC 1,607 ms
9,052 KB
testcase_28 AC 1,753 ms
9,052 KB
testcase_29 AC 1,650 ms
9,052 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using ll=long long;
#define rep(i,s,n) for (ll i = (s); i < (n); i++)
using namespace std;
using Graph = vector<vector<ll>>;
ll MOD=998244353;
const ll INF=1e18;

ll dp[20010][35];

int main(){
  rep(i,0,20010){
    rep(j,0,35){
      dp[i][j]=0;
    }
  }
  ll N,M,K;
  cin>>N>>M>>K;
  rep(i,0,35){
    dp[0][i]=1;
  }
  rep(i,1,M){
    rep(j0,0,(1<<N)){
      int bit0[N];
      rep(k,0,N){
        int Div=(1<<k);
        bit0[k]=(j0/Div)%2;
      }
      rep(j1,0,(1<<N)){
        int bit1[N];
        rep(k,0,N){
          int Div=(1<<k);
          bit1[k]=(j1/Div)%2;
        }
        ll cnt=0;
        rep(k,0,N){
          if(bit0[k]==1 && bit1[k]==1){
            cnt++;
          }
        }
        if(cnt>=K){
          dp[i][j1]+=dp[i-1][j0];
          dp[i][j1]%=MOD;
        }
      }
    }
  }
  ll ans=0;
  rep(i,0,(1<<N)){
    ans+=dp[M-1][i];
    ans%=MOD;
  }
  cout<<ans<<endl;
}
0