結果

問題 No.1189 Sum is XOR
ユーザー auauaauaua
提出日時 2020-08-22 15:48:45
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,381 bytes
コンパイル時間 1,753 ms
コンパイル使用メモリ 169,412 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-23 10:04:56
合計ジャッジ時間 3,532 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 22 ms
5,376 KB
testcase_04 AC 19 ms
5,376 KB
testcase_05 AC 31 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 11 ms
5,376 KB
testcase_10 AC 10 ms
5,376 KB
testcase_11 WA -
testcase_12 AC 55 ms
5,376 KB
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 AC 11 ms
5,376 KB
testcase_22 AC 11 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

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(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;
                    }
                }
            }
        }
        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