結果

問題 No.1304 あなたは基本が何か知っていますか?私は知っています.
ユーザー 🍮かんプリン🍮かんプリン
提出日時 2020-12-01 07:58:28
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 203 ms / 2,000 ms
コード長 3,380 bytes
コンパイル時間 1,984 ms
コンパイル使用メモリ 178,432 KB
実行使用メモリ 258,356 KB
最終ジャッジ日時 2023-09-03 03:18:06
合計ジャッジ時間 12,843 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 21 ms
27,844 KB
testcase_01 AC 33 ms
44,268 KB
testcase_02 AC 22 ms
28,024 KB
testcase_03 AC 203 ms
258,356 KB
testcase_04 AC 32 ms
27,824 KB
testcase_05 AC 27 ms
27,844 KB
testcase_06 AC 24 ms
27,848 KB
testcase_07 AC 30 ms
27,824 KB
testcase_08 AC 50 ms
60,588 KB
testcase_09 AC 30 ms
27,888 KB
testcase_10 AC 28 ms
28,024 KB
testcase_11 AC 30 ms
27,828 KB
testcase_12 AC 30 ms
27,848 KB
testcase_13 AC 27 ms
27,884 KB
testcase_14 AC 29 ms
27,816 KB
testcase_15 AC 27 ms
27,804 KB
testcase_16 AC 30 ms
27,872 KB
testcase_17 AC 42 ms
44,432 KB
testcase_18 AC 30 ms
27,804 KB
testcase_19 AC 26 ms
27,988 KB
testcase_20 AC 22 ms
27,876 KB
testcase_21 AC 42 ms
44,228 KB
testcase_22 AC 30 ms
27,800 KB
testcase_23 AC 30 ms
27,872 KB
testcase_24 AC 31 ms
27,876 KB
testcase_25 AC 86 ms
109,984 KB
testcase_26 AC 48 ms
60,540 KB
testcase_27 AC 53 ms
60,560 KB
testcase_28 AC 64 ms
77,200 KB
testcase_29 AC 52 ms
60,572 KB
testcase_30 AC 71 ms
93,536 KB
testcase_31 AC 111 ms
142,940 KB
testcase_32 AC 55 ms
60,540 KB
testcase_33 AC 84 ms
109,908 KB
testcase_34 AC 52 ms
60,560 KB
testcase_35 AC 72 ms
93,764 KB
testcase_36 AC 98 ms
126,616 KB
testcase_37 AC 77 ms
93,540 KB
testcase_38 AC 76 ms
93,544 KB
testcase_39 AC 122 ms
159,300 KB
testcase_40 AC 76 ms
93,572 KB
testcase_41 AC 129 ms
159,356 KB
testcase_42 AC 78 ms
93,636 KB
testcase_43 AC 74 ms
93,564 KB
testcase_44 AC 100 ms
126,620 KB
04_evil_A_01 RE -
04_evil_A_02 RE -
04_evil_A_03 RE -
04_evil_A_04 RE -
04_evil_A_05 RE -
04_evil_A_06 RE -
04_evil_A_07 RE -
04_evil_A_08 RE -
04_evil_A_09 RE -
04_evil_A_10 RE -
05_evil_B_01 RE -
05_evil_B_02 RE -
05_evil_B_03 RE -
05_evil_B_04 RE -
05_evil_B_05 RE -
05_evil_B_06 RE -
05_evil_B_07 RE -
05_evil_B_08 RE -
05_evil_B_09 RE -
05_evil_B_10 RE -
06_evil_C_01 RE -
06_evil_C_02 RE -
06_evil_C_03 RE -
06_evil_C_04 RE -
06_evil_C_05 RE -
06_evil_C_06 RE -
06_evil_C_07 RE -
06_evil_C_08 RE -
06_evil_C_09 RE -
06_evil_C_10 AC 14 ms
19,372 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

/**
 *   @FileName	a.cpp
 *   @Author	kanpurin
 *   @Created	2020.12.01 07:58:21
**/

#include "bits/stdc++.h" 
using namespace std; 
typedef long long ll;

template< int MOD >
struct mint {
public:
    long long x;
    mint(long long x = 0) :x((x%MOD+MOD)%MOD) {}
    mint(std::string &s) {
        long long z = 0;
        for (int i = 0; i < s.size(); i++) {
            z *= 10;
            z += s[i] - '0';
            z %= MOD;
        }
        this->x = z;
    }
    mint& operator+=(const mint &a) {
        if ((x += a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator-=(const mint &a) {
        if ((x += MOD - a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator*=(const mint &a) {
        (x *= a.x) %= MOD;
        return *this;
    }
    mint& operator/=(const mint &a) {
        long long n = MOD - 2;
        mint u = 1, b = a;
        while (n > 0) {
            if (n & 1) {
                u *= b;
            }
            b *= b;
            n >>= 1;
        }
        return *this *= u;
    }
    mint operator+(const mint &a) const {
        mint res(*this);
        return res += a;
    }
    mint operator-() const {return mint() -= *this; }
    mint operator-(const mint &a) const {
        mint res(*this);
        return res -= a;
    }
    mint operator*(const mint &a) const {
        mint res(*this);
        return res *= a;
    }
    mint operator/(const mint &a) const {
        mint res(*this);
        return res /= a;
    }
    friend std::ostream& operator<<(std::ostream &os, const mint &n) {
        return os << n.x;
    }
    friend std::istream &operator>>(std::istream &is, mint &n) {
        long long x;
        is >> x;
        n = mint(x);
        return is;
    }
    bool operator==(const mint &a) const {
        return this->x == a.x;
    }
    bool operator!=(const mint &a) const {
        return this->x != a.x;
    }
    mint pow(long long k) const {
        mint ret = 1;
        mint p = this->x;
        while (k > 0) {
            if (k & 1) {
                ret *= p;
            }
            p *= p;
            k >>= 1;
        }
        return ret;
    }
};
constexpr int MOD = 998244353;
int main() {
    int n,k,x,y;cin >> n >> k >> x >> y;
    vector<int> a(k);
    vector<bool> b(1024,false);
    vector<int> c;
    for (int i = 0; i < k; i++) {
        cin >> a[i];
        if (!b[a[i]]) c.push_back(a[i]);
        b[a[i]] = true;
    }
    sort(c.begin(), c.end());
    vector<vector<vector<mint<MOD>>>> dp(n,vector<vector<mint<MOD>>>(1024,vector<mint<MOD>>(1024)));
    for (int i = 0; i < 1024; i++) {
        if (b[i]) dp[0][i][i] = 1;
    }
    for (int i = 1; i < n; i++) {
        vector<mint<MOD>> sum(1024,0);
        for (int s = 0; s < 1024; s++) {
            for (int j = 0; j < c.size(); j++) {
                sum[s] += dp[i-1][s][c[j]];
            }
        }
        for (int s = 0; s < 1024; s++) {
            for (int j = 0; j < c.size(); j++) {
                dp[i][s][c[j]] = sum[s^c[j]] - dp[i-1][s^c[j]][c[j]];
                
                
                
                
            }
        }
    }
    y = min(1023,y);
    x = max(min(1023,x),0);
    mint<MOD> ans = 0;
    for (int i = 0; i < 1024; i++) {
        for (int j = x; j <= y; j++) {
            ans += dp[n-1][j][i];
        }
    }
    cout << ans << endl;
    return 0;
}
0