結果

問題 No.1304 あなたは基本が何か知っていますか?私は知っています.
ユーザー mfbgjsczmfbgjscz
提出日時 2020-12-02 16:09:31
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 41 ms / 2,000 ms
コード長 1,799 bytes
コンパイル時間 2,595 ms
コンパイル使用メモリ 213,592 KB
実行使用メモリ 11,828 KB
最終ジャッジ日時 2023-09-03 04:00:47
合計ジャッジ時間 21,549 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
11,828 KB
testcase_01 AC 39 ms
11,576 KB
testcase_02 AC 40 ms
11,588 KB
testcase_03 AC 40 ms
11,576 KB
testcase_04 AC 40 ms
11,816 KB
testcase_05 AC 40 ms
11,808 KB
testcase_06 AC 39 ms
11,640 KB
testcase_07 AC 41 ms
11,708 KB
testcase_08 AC 39 ms
11,660 KB
testcase_09 AC 40 ms
11,600 KB
testcase_10 AC 40 ms
11,604 KB
testcase_11 AC 39 ms
11,600 KB
testcase_12 AC 40 ms
11,704 KB
testcase_13 AC 39 ms
11,632 KB
testcase_14 AC 39 ms
11,716 KB
testcase_15 AC 39 ms
11,592 KB
testcase_16 AC 40 ms
11,636 KB
testcase_17 AC 39 ms
11,624 KB
testcase_18 AC 39 ms
11,696 KB
testcase_19 AC 39 ms
11,660 KB
testcase_20 AC 39 ms
11,584 KB
testcase_21 AC 39 ms
11,596 KB
testcase_22 AC 40 ms
11,596 KB
testcase_23 AC 39 ms
11,768 KB
testcase_24 AC 40 ms
11,576 KB
testcase_25 AC 39 ms
11,656 KB
testcase_26 AC 40 ms
11,564 KB
testcase_27 AC 39 ms
11,592 KB
testcase_28 AC 40 ms
11,680 KB
testcase_29 AC 40 ms
11,588 KB
testcase_30 AC 39 ms
11,584 KB
testcase_31 AC 39 ms
11,564 KB
testcase_32 AC 40 ms
11,644 KB
testcase_33 AC 40 ms
11,564 KB
testcase_34 AC 40 ms
11,652 KB
testcase_35 AC 39 ms
11,588 KB
testcase_36 AC 39 ms
11,588 KB
testcase_37 AC 39 ms
11,580 KB
testcase_38 AC 40 ms
11,700 KB
testcase_39 AC 39 ms
11,696 KB
testcase_40 AC 40 ms
11,684 KB
testcase_41 AC 41 ms
11,636 KB
testcase_42 AC 40 ms
11,584 KB
testcase_43 AC 40 ms
11,700 KB
testcase_44 AC 40 ms
11,644 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>
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
#define ll long long
#define rep(i, m, n) for (ll i = m; i < n; i++)
#define UE(N) N.erase(unique(N.begin(), N.end()), N.end());
#define Sort(n) sort(n.begin(), n.end())
#define mod 998244353

ll N, K;
vector<ll> A;
vector<vector<ll>> B(1024, vector<ll>(1024));
void dfs(ll cnt, ll x, ll prev) {
    if(!cnt) B[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();
    dfs(N / 2, 0, -1);
    ll res = 0;
    vector<ll> C(1024), tmp(1024);
    rep(i, 0, 1024) rep(j, 0, 1024) tmp[i] += B[j][i];
    rep(i, 0, 1024) rep(j, 0, 1024) C[i ^ j] += tmp[i] * tmp[j];
    rep(i, 0, 1024) {
        fwt(B[i]);
        rep(j, 0, 1024) B[i][j] *= B[i][j];
        ifwt(B[i]);
    }
    rep(i, 0, 1024) rep(j, 0, 1024) C[i] -= B[j][i];
    rep(i, min(X, 1023LL), min(Y + 1, 1024LL)) res += C[i];
    cout << res % mod << endl;
}
0