結果

問題 No.1189 Sum is XOR
ユーザー auauaauaua
提出日時 2020-08-22 15:36:26
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
MLE  
実行時間 -
コード長 1,217 bytes
コンパイル時間 2,173 ms
コンパイル使用メモリ 170,360 KB
実行使用メモリ 814,668 KB
最終ジャッジ日時 2024-04-23 09:54:18
合計ジャッジ時間 5,281 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#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 int 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(n);
    rep(i,n)cin>>a[i];
    if(k>=11){
        cout<<0<<endl;
        return 0;
    }
    vector<vector<vector<ll> > >dp(n+1,vector<vector<ll> >(k+1,vector<ll>(1024)));
    dp[0][0][0]=1;
    rep(i,n){
        rep(j,k+1){
            rep(l,1024){
                dp[i+1][j][l]=(dp[i+1][j][l]+dp[i][j][l])%mod;
                if(j<k){
                    if(a[i]+l==(a[i]^l)){
                        dp[i+1][j+1][l+a[i]]=(dp[i+1][j+1][l+a[i]]+dp[i][j][l])%mod;
                    }
                }
            }
        }
    }
    ll ans=0;
    rep(i,1024){
        ans=(ans+dp[n][k][i])%mod;
    }
    cout<<ans<<endl;
}
0