結果

問題 No.1304 あなたは基本が何か知っていますか?私は知っています.
ユーザー Haa
提出日時 2020-12-01 18:32:11
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
RE  
実行時間 -
コード長 784 bytes
コンパイル時間 1,456 ms
コンパイル使用メモリ 167,756 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2025-06-22 02:40:58
合計ジャッジ時間 11,257 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 43 RE * 21 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){
				REP(k,n){
					if(k%2==0)
						dp[i+1+k][j^x]=(dp[i+1+k][j^x]+dp[i][j])%MOD;
					else
						dp[i+1+k][j]=(dp[i+1+k][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