結果

問題 No.1710 Minimum OR is X
ユーザー たたき@競プロたたき@競プロ
提出日時 2023-08-26 10:43:15
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 78 ms / 2,000 ms
コード長 1,720 bytes
コンパイル時間 5,541 ms
コンパイル使用メモリ 311,176 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-26 10:43:28
合計ジャッジ時間 7,569 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 7 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 15 ms
4,376 KB
testcase_09 AC 14 ms
4,380 KB
testcase_10 AC 22 ms
4,376 KB
testcase_11 AC 14 ms
4,380 KB
testcase_12 AC 24 ms
4,376 KB
testcase_13 AC 18 ms
4,376 KB
testcase_14 AC 21 ms
4,376 KB
testcase_15 AC 7 ms
4,380 KB
testcase_16 AC 23 ms
4,376 KB
testcase_17 AC 6 ms
4,380 KB
testcase_18 AC 58 ms
4,376 KB
testcase_19 AC 37 ms
4,380 KB
testcase_20 AC 10 ms
4,376 KB
testcase_21 AC 66 ms
4,380 KB
testcase_22 AC 78 ms
4,376 KB
testcase_23 AC 1 ms
4,380 KB
testcase_24 AC 1 ms
4,376 KB
testcase_25 AC 1 ms
4,380 KB
testcase_26 AC 2 ms
4,380 KB
testcase_27 AC 2 ms
4,376 KB
testcase_28 AC 7 ms
4,380 KB
testcase_29 AC 2 ms
4,380 KB
testcase_30 AC 1 ms
4,376 KB
testcase_31 AC 1 ms
4,380 KB
testcase_32 AC 7 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
using mint=modint998244353; //1000000007;
using ll=long long;
using pp=pair<int,int>;
#define sr string 
#define vc vector
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define pb push_back
#define all(v) v.begin(),v.end()
#define pque priority_queue
#define bpc(a) __builtin_popcount(a)
struct modinv {
  int n; vector<mint> d;
  modinv(): n(2), d({0,1}) {}
  mint operator()(int i) {
    while (n <= i) d.push_back(-d[mint::mod()%n]*(mint::mod()/n)), ++n;
    return d[i];
  }
  mint operator[](int i) const { return d[i];}
} invs;
struct modfact {
  int n; vector<mint> d;
  modfact(): n(2), d({1,1}) {}
  mint operator()(int i) {
    while (n <= i) d.push_back(d.back()*n), ++n;
    return d[i];
  }
  mint operator[](int i) const { return d[i];}
} facts;
struct modfactinv {
  int n; vector<mint> d;
  modfactinv(): n(2), d({1,1}) {}
  mint operator()(int i) {
    while (n <= i) d.push_back(d.back()*invs(n)), ++n;
    return d[i];
  }
  mint operator[](int i) const { return d[i];}
} ifacts;
mint comb(int n, int k) {
  if (n < k || k < 0) return 0;
  return facts(n)*ifacts(k)*ifacts(n-k);
} 
int main(){
  int n,m,k; sr x;cin>>n>>m>>k>>x;
  vc<mint>dp(n+1,0);  dp[n]=1;
  rep(i,m){
    vc<mint>pre(n+1,0); swap(pre,dp);
    if(x[i]=='0'){
      for(int j=k;j<=n;j++)for(int t=j;t<=n;t++){
        dp[j]+=pre[t]*comb(t,j)*mint(2).pow((t-j)*(m-i-1));
      }
    }
    else{
      for(int j=k;j<=n;j++)for(int t=0;t<k;t++){
        dp[j]+=pre[j]*comb(j,t);
      }
    }
    //cout<<dp[2].val()<<' '<<dp[3].val()<<"\n";
  }
  mint ans=0; for(auto au:dp)ans+=au;
  cout<<ans.val();
}
     
0