結果
| 問題 | 
                            No.1304 あなたは基本が何か知っていますか?私は知っています.
                             | 
                    
| コンテスト | |
| ユーザー | 
                             Haa
                         | 
                    
| 提出日時 | 2020-12-01 18:29:56 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                RE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 720 bytes | 
| コンパイル時間 | 1,689 ms | 
| コンパイル使用メモリ | 168,048 KB | 
| 実行使用メモリ | 7,848 KB | 
| 最終ジャッジ日時 | 2025-06-22 02:40:44 | 
| 合計ジャッジ時間 | 12,355 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | AC * 6 WA * 37 RE * 21 TLE * 1 -- * 9 | 
ソースコード
#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,32){
			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;
	for(int i=x;i<=y;i++){
		ans=(ans+dp[n][i])%MOD;
	}
	cout << ans << endl;
	return 0;
}
            
            
            
        
            
Haa