結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 48 ms
5,248 KB
testcase_01 AC 47 ms
5,376 KB
testcase_02 AC 47 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 18 ms
5,376 KB
testcase_12 AC 47 ms
5,376 KB
testcase_13 AC 42 ms
5,376 KB
testcase_14 AC 31 ms
5,376 KB
testcase_15 AC 17 ms
5,376 KB
testcase_16 AC 14 ms
5,376 KB
testcase_17 AC 17 ms
5,376 KB
testcase_18 AC 22 ms
5,376 KB
testcase_19 AC 36 ms
5,376 KB
testcase_20 AC 37 ms
5,376 KB
testcase_21 AC 10 ms
5,376 KB
testcase_22 AC 10 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 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