結果

問題 No.1189 Sum is XOR
ユーザー ShibuyapShibuyap
提出日時 2020-08-22 15:42:16
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 1,038 bytes
コンパイル時間 1,903 ms
コンパイル使用メモリ 195,952 KB
実行使用メモリ 93,728 KB
最終ジャッジ日時 2024-04-23 09:59:29
合計ジャッジ時間 6,113 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
93,728 KB
testcase_01 AC 71 ms
93,720 KB
testcase_02 AC 71 ms
93,564 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 44 ms
93,564 KB
testcase_12 AC 78 ms
93,680 KB
testcase_13 AC 68 ms
93,672 KB
testcase_14 AC 56 ms
93,540 KB
testcase_15 AC 42 ms
93,660 KB
testcase_16 AC 39 ms
93,688 KB
testcase_17 AC 42 ms
93,544 KB
testcase_18 AC 49 ms
93,652 KB
testcase_19 AC 62 ms
93,672 KB
testcase_20 AC 62 ms
93,728 KB
testcase_21 AC 37 ms
93,680 KB
testcase_22 AC 36 ms
93,536 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define srep(i,s,t) for(int i = s; i < t; ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005
ll dp[1024][1024][11];
int main() {
    ll cnt[1024] = {};
    int n, K;
    cin >> n >> K;
    rep(i,n){
        int a;
        cin >> a;
        cnt[a]++;
    }
    ll MOD = 998244353;
    
    rep(i,1024)rep(j,1024)rep(k,11)dp[i][j][k] = 0;
    dp[0][0][0] = 1;
    srep(i,1,1024){
        rep(j,1024)rep(k,11)dp[i][j][k] = dp[i-1][j][k];
        rep(j,1024){
            int x = i + j;
            int y = (i ^ j);
            if(x != y) continue;
            srep(k,1,11){
                dp[i][y][k] += dp[i-1][j][k-1] * cnt[i];
                dp[i][y][k] %= MOD;
            }
        }
    }
    ll ans = 0;
    rep(j,1024){
        ans += dp[1023][j][K];
        ans %= MOD;
    }
    cout << ans << endl;
    return 0;
}


0