結果

問題 No.2711 Connecting Lights
コンテスト
ユーザー Rumain831
提出日時 2026-08-25 04:50:57
言語 C++23(gcc16)
(gcc 16.1.0 + boost 1.92.0)
コンパイル:
g++-16 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 69 ms / 5,000 ms
+ 345µs
コード長 507 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,994 ms
コンパイル使用メモリ 176,064 KB
実行使用メモリ 6,272 KB
最終ジャッジ日時 2026-08-25 04:51:02
合計ジャッジ時間 4,242 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
using ll = long long;

int main(void){
  int n, m, k; cin >> n >> m >> k;
  int mx=(1<<n);
  ll mod=998244353;
  vector<ll> dp(mx, 1);
  for(int i=0; i<m-1; i++){
    vector<ll> old(mx);
    swap(old, dp);
    for(int p=0; p<mx; p++)for(int q=0; q<mx; q++){
      int x=__builtin_popcount(p&q);
      if(x>=k) dp[q]+=old[p], dp[q]%=mod;
    }
  }
  ll ans=0;
  for(auto&x:dp) ans+=x, ans%=mod;
  cout << ans << endl;
  return 0;
}
0