結果
| 問題 | 
                            No.1304 あなたは基本が何か知っていますか?私は知っています.
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2020-12-02 20:53:09 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 927 bytes | 
| コンパイル時間 | 1,498 ms | 
| コンパイル使用メモリ | 167,196 KB | 
| 実行使用メモリ | 173,592 KB | 
| 最終ジャッジ日時 | 2025-06-22 02:59:39 | 
| 合計ジャッジ時間 | 33,103 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | AC * 36 WA * 9 RE * 29 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int MOD = 998244353;
int dp[41][1030][1030];
void add(int &a, int b)
{
    a = (a+b) % MOD;
}
int main()
{
    int n, k, x, y;
    cin >> n >> k >> x >> y;
    set<int> s;
    rep(i, k)
    {
        int a;
        cin >> a;
        s.insert(a);
    }
    memset(dp, 0, sizeof(dp));
    int mn = 1030;
    dp[0][0][0] = 1;
    rep(i, n)
    {
        rep(j, mn)
        {
            int sum = 0;
            rep(t, mn) add(sum, dp[i][j][t]);
            if(sum == 0) continue;
            for(int l : s)
            {
                add(sum, -dp[i][j][l]);
                add(dp[i+1][j^l][l], sum);
                add(sum, dp[i][j][l]);
            }
        }
    }
    int ans = 0;
    for(int i = x; i <= y; i++) rep(j, 1030) add(ans, dp[n][i][j]);
    cout << ans << endl;
}