結果

問題 No.1189 Sum is XOR
ユーザー chocoruskchocorusk
提出日時 2020-08-22 13:35:17
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,143 bytes
コンパイル時間 1,061 ms
コンパイル使用メモリ 125,724 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-23 08:00:44
合計ジャッジ時間 2,354 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 1 ms
6,940 KB
testcase_04 AC 2 ms
6,944 KB
testcase_05 AC 1 ms
6,940 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 AC 2 ms
6,940 KB
testcase_08 AC 2 ms
6,944 KB
testcase_09 AC 2 ms
6,944 KB
testcase_10 AC 2 ms
6,944 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
const ll MOD=998244353;
ll dp[11][1<<10];
int main()
{
    int n, k;
    cin>>n>>k;
    if(k>10){
        cout<<0<<endl;
        return 0;
    }
    int a[200020];
    for(int i=0; i<n; i++) cin>>a[i];
    int cnt[1<<10]={};
    for(int i=0; i<n; i++) cnt[a[i]]++;
    dp[0][0]=1;
    for(int i=1; i<(1<<10); i++){
        for(int j=i; j>0; j=(j-1)&i){
            for(int l=1; l<=k; l++){
                dp[l][i]+=dp[l-1][i-j]*cnt[j];
                dp[l][i]%=MOD;
            }
        }
    }
    ll ans=0;
    for(int i=0; i<(1<<10); i++) (ans+=dp[k][i])%=MOD;
    cout<<ans<<endl;
    return 0;
}
0