結果

問題 No.1189 Sum is XOR
ユーザー umezoumezo
提出日時 2020-08-28 01:16:59
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 49 ms / 2,000 ms
コード長 625 bytes
コンパイル時間 2,122 ms
コンパイル使用メモリ 195,940 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-26 10:25:55
合計ジャッジ時間 3,852 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 48 ms
6,812 KB
testcase_01 AC 48 ms
6,940 KB
testcase_02 AC 47 ms
6,944 KB
testcase_03 AC 21 ms
6,944 KB
testcase_04 AC 18 ms
6,940 KB
testcase_05 AC 30 ms
6,944 KB
testcase_06 AC 41 ms
6,940 KB
testcase_07 AC 26 ms
6,944 KB
testcase_08 AC 11 ms
6,940 KB
testcase_09 AC 11 ms
6,940 KB
testcase_10 AC 9 ms
6,944 KB
testcase_11 AC 14 ms
6,940 KB
testcase_12 AC 49 ms
6,944 KB
testcase_13 AC 41 ms
6,940 KB
testcase_14 AC 28 ms
6,940 KB
testcase_15 AC 15 ms
6,944 KB
testcase_16 AC 12 ms
6,940 KB
testcase_17 AC 15 ms
6,944 KB
testcase_18 AC 22 ms
6,940 KB
testcase_19 AC 36 ms
6,944 KB
testcase_20 AC 37 ms
6,944 KB
testcase_21 AC 8 ms
6,944 KB
testcase_22 AC 7 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

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

const ll MOD=998244353;
ll dp[11][1024];

int main(){
  ll n,k;
  cin>>n>>k;
  
  vector<ll> A(1024);
  ll x;
  rep(i,n){
    cin>>x;
    A[x]++;
  }
  
  if(k>10){
    cout<<0<<endl;
    return 0;
  }
  dp[0][0]=1;
  rep(i,10){
    rep(j,1024){
      for(int l=j+1;l<1024;l++){
        if(j+l==(j^l) && j+l<1024) dp[i+1][j+l]=(dp[i+1][j+l]+dp[i][j]*A[l]%MOD)%MOD;
      }
    }
  }
  ll ans=0;
  rep(i,1024) ans=(ans+dp[k][i])%MOD;
  cout<<ans<<endl;
  
  return 0;
}
0