結果

問題 No.1304 あなたは基本が何か知っていますか?私は知っています.
ユーザー Haa
提出日時 2020-12-01 18:34:13
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 22 ms / 2,000 ms
コード長 801 bytes
コンパイル時間 1,414 ms
コンパイル使用メモリ 167,596 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2025-06-22 02:41:12
合計ジャッジ時間 11,131 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
外部呼び出し有り
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 44 RE * 20 TLE * 1 -- * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;
typedef vector<ll> VI;
typedef vector<VI> VVI;
#define REP(i,n) for(int i=0;i<n;i++)
#define ALL(v) v.begin(),v.end()
constexpr ll MOD=998244353;
constexpr ll INF=1e18;

int main(){
	int n, k, x, y;
	cin >> n >> k >> x >> y;
	set<int> st; int a;
	REP(i,k){
		cin >> a;
		st.insert(a);
	}
	ll dp[45][1024]={0};
	dp[0][0]=1;
	REP(i,n){
		REP(j,1024){
			for(int x:st){
				for(int l=0;i+1+l<=n;l++){
					if(l%2==0)
						dp[i+1+l][j^x]=(dp[i+1+l][j^x]+dp[i][j])%MOD;
					else
						dp[i+1+l][j]=(dp[i+1+l][j]+MOD-dp[i][j])%MOD;
				}
			}
		}
	}
	ll ans=0;
	if(x>=1024){
		cout << 0 << endl;
	}
	else{
		for(int i=x;i<=min(1023,y);i++){
			ans=(ans+dp[n][i])%MOD;
		}
		cout << ans << endl;
	}
	return 0;
}
0