結果

問題 No.1304 あなたは基本が何か知っていますか?私は知っています.
ユーザー mfbgjsczmfbgjscz
提出日時 2020-12-01 16:53:52
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 42 ms / 2,000 ms
コード長 2,604 bytes
コンパイル時間 2,056 ms
コンパイル使用メモリ 214,232 KB
実行使用メモリ 11,960 KB
最終ジャッジ日時 2023-09-03 03:30:16
合計ジャッジ時間 19,155 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
11,696 KB
testcase_01 AC 39 ms
11,684 KB
testcase_02 AC 39 ms
11,680 KB
testcase_03 AC 40 ms
11,948 KB
testcase_04 AC 40 ms
11,688 KB
testcase_05 AC 39 ms
11,900 KB
testcase_06 AC 39 ms
11,640 KB
testcase_07 AC 38 ms
11,708 KB
testcase_08 AC 39 ms
11,704 KB
testcase_09 AC 39 ms
11,688 KB
testcase_10 AC 38 ms
11,836 KB
testcase_11 AC 40 ms
11,960 KB
testcase_12 AC 40 ms
11,704 KB
testcase_13 AC 41 ms
11,684 KB
testcase_14 AC 39 ms
11,640 KB
testcase_15 AC 40 ms
11,632 KB
testcase_16 AC 41 ms
11,652 KB
testcase_17 AC 39 ms
11,636 KB
testcase_18 AC 41 ms
11,648 KB
testcase_19 AC 40 ms
11,764 KB
testcase_20 AC 39 ms
11,640 KB
testcase_21 AC 42 ms
11,696 KB
testcase_22 AC 41 ms
11,640 KB
testcase_23 AC 38 ms
11,648 KB
testcase_24 AC 38 ms
11,636 KB
testcase_25 AC 38 ms
11,640 KB
testcase_26 AC 41 ms
11,632 KB
testcase_27 AC 39 ms
11,832 KB
testcase_28 AC 42 ms
11,632 KB
testcase_29 AC 38 ms
11,752 KB
testcase_30 AC 37 ms
11,776 KB
testcase_31 AC 37 ms
11,912 KB
testcase_32 AC 36 ms
11,760 KB
testcase_33 AC 36 ms
11,760 KB
testcase_34 AC 41 ms
11,628 KB
testcase_35 AC 39 ms
11,688 KB
testcase_36 AC 40 ms
11,824 KB
testcase_37 AC 41 ms
11,688 KB
testcase_38 AC 39 ms
11,904 KB
testcase_39 AC 37 ms
11,908 KB
testcase_40 AC 38 ms
11,764 KB
testcase_41 AC 38 ms
11,632 KB
testcase_42 AC 38 ms
11,640 KB
testcase_43 AC 37 ms
11,696 KB
testcase_44 AC 40 ms
11,628 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 MLE -
06_evil_C_02 MLE -
06_evil_C_03 MLE -
06_evil_C_04 MLE -
06_evil_C_05 MLE -
06_evil_C_06 MLE -
06_evil_C_07 MLE -
06_evil_C_08 MLE -
06_evil_C_09 MLE -
06_evil_C_10 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
//namespace mp = boost::multiprecision;
//using Bll = mp::cpp_int;
using namespace std;
#define ll long long
#define rep(i, m, n) for (ll i = m; i < n; i++)
#define rrep(i, m, n) for (ll i = m - 1; i >= n; i--)
#define pb(n) push_back(n)
#define UE(N) N.erase(unique(N.begin(), N.end()), N.end());
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(), n.end())
#define HpOut(S) cout << setprecision(50) << S << endl
#define Vec(K, L, N, S) vector<L> K(N, S)
#define DV(K, L, N, M, S) vector<vector<L>> K(N, vector<L>(M, S))
#define TV(K, L, N, M, R, S) \
    vector<vector<vector<L>>> K(N, vector<vector<L>>(M, vector<L>(R, S)))
#define pint pair<ll, ll>
#define tint tuple<int, int, int>
#define paf(L, R) pair<L, R>
#define mod 998244353
#define MAX 10010
#define ALL(a) a.begin(), a.end()
#define chmax(a, b) a = (((a) < (b)) ? (b) : (a))
#define chmin(a, b) a = (((a) > (b)) ? (b) : (a))
ll N, K;
vector<ll> A;
vector<vector<ll>> ans(1024, vector<ll>(1024));
void dfs(ll cnt, ll x, ll prev) {
    if(!cnt) ans[prev][x]++;
    else {
        rep(i, 0, K) {
            if(A[i] == prev) continue;
            dfs(cnt - 1, x ^ A[i], A[i]);
        }
    }
}

void fwt(vector<ll>& f) {
    int n = f.size();
    for (int i = 1; i < n; i <<= 1) {
        for (int j = 0; j < n; j++) {
            if ((j & i) == 0) {
                ll x = f[j], y = f[j | i];
                f[j] = x + y, f[j | i] = x - y;
            }
        }
    }
}

void ifwt(vector<ll>& f) {
    int n = f.size();
    for (int i = 1; i < n; i <<= 1) {
        for (int j = 0; j < n; j++) {
            if ((j & i) == 0) {
                ll x = f[j], y = f[j | i];
                f[j] = (x + y) / 2, f[j | i] = (x - y) / 2;
            }
        }
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll X, Y;
    cin >> N >> K >> X >> Y;
    A.resize(K);
    rep(i, 0, K) cin >> A[i];
    Sort(A), UE(A);
    K = A.size();
    ll L = N / 2;
    dfs(L, 0, -1);
    ll res = 0;
    vector<ll> cus(1024), tmp(1024);
    rep(i, 0, 1024) rep(j, 0, 1024) tmp[i] += ans[j][i];
    rep(i, 0, 1024) rep(j, 0, 1024) cus[i ^ j] = (cus[i ^ j] + tmp[i] * tmp[j]) % mod;
    rep(i, 0, 1024) {
        fwt(ans[i]);
        rep(j, 0, 1024) ans[i][j] *= ans[i][j];
        ifwt(ans[i]);
    }
    rep(i, 0, 1024) rep(j, 0, 1024) cus[i] = (cus[i] - ans[j][i] + mod) % mod;
    rep(i, X, Y + 1) res += cus[i];
    cout << res % mod << endl;
}
0