結果
| 問題 |
No.1189 Sum is XOR
|
| コンテスト | |
| ユーザー |
auaua
|
| 提出日時 | 2020-08-22 15:36:26 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 1,217 bytes |
| コンパイル時間 | 1,764 ms |
| コンパイル使用メモリ | 173,468 KB |
| 実行使用メモリ | 816,512 KB |
| 最終ジャッジ日時 | 2024-10-15 09:49:02 |
| 合計ジャッジ時間 | 6,280 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 2 |
| other | MLE * 1 -- * 20 |
ソースコード
#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;
}
auaua