結果

問題 No.1189 Sum is XOR
ユーザー umezoumezo
提出日時 2020-08-27 18:13:58
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 576 bytes
コンパイル時間 2,443 ms
コンパイル使用メモリ 195,724 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-25 11:22:21
合計ジャッジ時間 5,252 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 47 ms
5,248 KB
testcase_01 AC 49 ms
5,376 KB
testcase_02 AC 48 ms
5,376 KB
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 AC 19 ms
5,376 KB
testcase_12 AC 48 ms
5,376 KB
testcase_13 AC 43 ms
5,376 KB
testcase_14 AC 33 ms
5,376 KB
testcase_15 AC 19 ms
5,376 KB
testcase_16 AC 16 ms
5,376 KB
testcase_17 AC 19 ms
5,376 KB
testcase_18 AC 24 ms
5,376 KB
testcase_19 AC 39 ms
5,376 KB
testcase_20 AC 43 ms
5,376 KB
testcase_21 AC 11 ms
5,376 KB
testcase_22 AC 11 ms
5,376 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]++;
  }
  
  dp[0][0]=1;
  rep(i,10){
    rep(j,1024){
      for(int k=j+1;k<1024;k++){
        if(j+k==(j^k) && j+k<1024) dp[i+1][j+k]=(dp[i+1][j+k]+dp[i][j]*A[k]%MOD)%MOD;
      }
    }
  }
  ll ans=0;
  rep(i,1024) ans=(ans+dp[k][i])%MOD;
  cout<<ans<<endl;
  
  return 0;
}
0