結果

問題 No.1189 Sum is XOR
ユーザー RhoRho
提出日時 2020-08-01 22:51:33
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 821 bytes
コンパイル時間 1,463 ms
コンパイル使用メモリ 165,752 KB
実行使用メモリ 4,508 KB
最終ジャッジ日時 2023-09-23 00:27:13
合計ジャッジ時間 7,503 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
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 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 AC 2 ms
4,380 KB
testcase_22 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define vi vector<int>
#define all(a) a.begin(),a.end()
typedef pair<int,int> P;
const long long mod=998244353;
const long long inf=1ll<<61;
const int maxN=100;
int a[105];
int dp[102][102][1024];
signed main(){
    int n,k;cin>>n>>k;
    rep(i,n)cin>>a[i];
    dp[0][0][0]=1;
    rep(i,n){
        rep(j,k+1){
            rep(l,1<<10){
                if(!dp[i][j][l])continue;
                dp[i+1][j][l]+=dp[i][j][l];
                dp[i+1][j][l]%=mod;
                if(!(l&a[i])){
                    dp[i+1][j+1][l|a[i]]+=dp[i][j][l];
                    dp[i+1][j+1][l|a[i]]%=mod;
                }
            }
        }
    }
    int sum=0;
    rep(i,1<<10)sum+=dp[n][k][i];
    cout<<sum%mod<<endl;
}
0