結果

問題 No.1189 Sum is XOR
ユーザー auauaauaua
提出日時 2020-08-22 15:51:57
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 77 ms / 2,000 ms
コード長 1,413 bytes
コンパイル時間 1,841 ms
コンパイル使用メモリ 167,948 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-23 10:07:29
合計ジャッジ時間 3,724 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
5,248 KB
testcase_01 AC 64 ms
5,376 KB
testcase_02 AC 59 ms
5,376 KB
testcase_03 AC 21 ms
5,376 KB
testcase_04 AC 20 ms
5,376 KB
testcase_05 AC 30 ms
5,376 KB
testcase_06 AC 44 ms
5,376 KB
testcase_07 AC 25 ms
5,376 KB
testcase_08 AC 12 ms
5,376 KB
testcase_09 AC 12 ms
5,376 KB
testcase_10 AC 9 ms
5,376 KB
testcase_11 AC 34 ms
5,376 KB
testcase_12 AC 58 ms
5,376 KB
testcase_13 AC 69 ms
5,376 KB
testcase_14 AC 57 ms
5,376 KB
testcase_15 AC 47 ms
5,376 KB
testcase_16 AC 51 ms
5,376 KB
testcase_17 AC 38 ms
5,376 KB
testcase_18 AC 36 ms
5,376 KB
testcase_19 AC 64 ms
5,376 KB
testcase_20 AC 73 ms
5,376 KB
testcase_21 AC 13 ms
5,376 KB
testcase_22 AC 14 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
#define endl '\n'
#define vec vector<ll>
#define mat vector<vector<ll> >
#define fi first
#define se second
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> pll;
typedef long double ld;
typedef complex<double> comp;
const ll inf=1e9+7;
const ll mod=998244353;
const int MAX=200010;


signed main(){
    ll n,k;cin>>n>>k;
    vector<ll>a(1024);
    rep(i,n){
        ll b;cin>>b;
        a[b]++;
    }
    n=1024;
    if(k>=11){
        cout<<0<<endl;
        return 0;
    }
    vector<vector<ll> >dp(k+1,vector<ll>(1024));
    vector<vector<ll> >dp1(k+1,vector<ll>(1024));
    dp[0][0]=1;
    rep(i,n){
        rep(j,k+1){
            rep(l,1024){
                dp1[j][l]=(dp1[j][l]+dp[j][l])%mod;
                if(j<k){
                    if(i+l==(i^l)){
                        dp1[j+1][l+i]=(dp1[j+1][l+i]+dp[j][l]*a[i]%mod)%mod;
                    }
                }
            }
        }
        rep(j,k+1){
            rep(l,1024){
                dp[j][l]=dp1[j][l];
                dp1[j][l]=0;
            }
        }
    }
    ll ans=0;
    rep(i,1024){
        ans=(ans+dp[k][i])%mod;
    }
    cout<<ans<<endl;
}
0