結果
問題 | No.1304 あなたは基本が何か知っていますか?私は知っています. |
ユーザー | SSRS |
提出日時 | 2020-12-02 00:40:56 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 89 ms / 2,000 ms |
コード長 | 1,828 bytes |
コンパイル時間 | 1,918 ms |
コンパイル使用メモリ | 176,172 KB |
実行使用メモリ | 11,904 KB |
最終ジャッジ日時 | 2024-06-12 13:35:41 |
合計ジャッジ時間 | 11,725 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 81 ms
11,648 KB |
testcase_01 | AC | 81 ms
11,776 KB |
testcase_02 | AC | 83 ms
11,776 KB |
testcase_03 | AC | 87 ms
11,776 KB |
testcase_04 | AC | 85 ms
11,776 KB |
testcase_05 | AC | 83 ms
11,904 KB |
testcase_06 | AC | 83 ms
11,776 KB |
testcase_07 | AC | 85 ms
11,776 KB |
testcase_08 | AC | 84 ms
11,776 KB |
testcase_09 | AC | 85 ms
11,776 KB |
testcase_10 | AC | 85 ms
11,776 KB |
testcase_11 | AC | 84 ms
11,776 KB |
testcase_12 | AC | 85 ms
11,776 KB |
testcase_13 | AC | 83 ms
11,776 KB |
testcase_14 | AC | 84 ms
11,776 KB |
testcase_15 | AC | 85 ms
11,776 KB |
testcase_16 | AC | 84 ms
11,648 KB |
testcase_17 | AC | 84 ms
11,648 KB |
testcase_18 | AC | 84 ms
11,776 KB |
testcase_19 | AC | 83 ms
11,776 KB |
testcase_20 | AC | 83 ms
11,776 KB |
testcase_21 | AC | 82 ms
11,776 KB |
testcase_22 | AC | 84 ms
11,648 KB |
testcase_23 | AC | 84 ms
11,648 KB |
testcase_24 | AC | 84 ms
11,776 KB |
testcase_25 | AC | 83 ms
11,648 KB |
testcase_26 | AC | 83 ms
11,648 KB |
testcase_27 | AC | 84 ms
11,776 KB |
testcase_28 | AC | 82 ms
11,776 KB |
testcase_29 | AC | 83 ms
11,648 KB |
testcase_30 | AC | 83 ms
11,776 KB |
testcase_31 | AC | 82 ms
11,776 KB |
testcase_32 | AC | 84 ms
11,776 KB |
testcase_33 | AC | 82 ms
11,904 KB |
testcase_34 | AC | 83 ms
11,776 KB |
testcase_35 | AC | 82 ms
11,776 KB |
testcase_36 | AC | 83 ms
11,648 KB |
testcase_37 | AC | 86 ms
11,648 KB |
testcase_38 | AC | 84 ms
11,776 KB |
testcase_39 | AC | 83 ms
11,776 KB |
testcase_40 | AC | 86 ms
11,648 KB |
testcase_41 | AC | 89 ms
11,776 KB |
testcase_42 | AC | 87 ms
11,776 KB |
testcase_43 | AC | 84 ms
11,776 KB |
testcase_44 | AC | 86 ms
11,776 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 | WA | - |
06_evil_C_02 | WA | - |
06_evil_C_03 | WA | - |
06_evil_C_04 | WA | - |
06_evil_C_05 | WA | - |
06_evil_C_06 | WA | - |
06_evil_C_07 | WA | - |
06_evil_C_08 | WA | - |
06_evil_C_09 | WA | - |
06_evil_C_10 | RE | - |
ソースコード
#include <bits/stdc++.h> using namespace std; const long long MOD = 998244353; void dfs(vector<vector<long long>> &H, vector<int> &A, int r, int prv, int x){ if (r == 0){ H[prv][x]++; } else { int K = A.size(); for (int j = 0; j < K; j++){ if (A[j] != prv){ dfs(H, A, r - 1, A[j], x ^ A[j]); } } } } vector<long long> fwt(vector<long long> A, int N, bool inv){ for (int i = 0; i < N; i++){ for (int j = 0; j < (1 << N); j++){ if (!(j >> i & 1)){ long long x = A[j]; long long y = A[j | (1 << i)]; A[j] = (x + y) % MOD; A[j | (1 << i)] = (x + MOD - y) % MOD; if (inv){ A[j] *= 499122177; A[j] %= MOD; A[j | (1 << i)] *= 499122177; A[j | (1 << i)] %= MOD; } } } } return A; } vector<long long> xor_convolution(vector<long long> A, vector<long long> B, int N){ A = fwt(A, N, false); B = fwt(B, N, false); vector<long long> C(1 << N); for (int i = 0; i < (1 << N); i++){ C[i] = A[i] * B[i] % MOD; } C = fwt(C, N, true); return C; } int main(){ int N, K, X, Y; cin >> N >> K >> X >> Y; vector<int> A(K); for (int i = 0; i < K; i++){ cin >> A[i]; } //sort(A.begin(), A.end()); //A.erase(unique(A.begin(), A.end()), A.end()); vector<vector<long long>> H(1024, vector<long long>(1024, 0)); dfs(H, A, N / 2, -1, 0); vector<long long> sum(1024, 0); for (int i = 0; i < 1024; i++){ for (int j = 0; j < 1024; j++){ sum[j] += H[i][j]; sum[j] %= MOD; } } sum = xor_convolution(sum, sum, 10); long long ans = 0; for (int i = X; i <= Y; i++){ ans += sum[i] % MOD; } ans %= MOD; for (int i = 0; i < 1024; i++){ H[i] = xor_convolution(H[i], H[i], 10); for (int j = X; j <= Y; j++){ ans += MOD - H[i][j] % MOD; } ans %= MOD; } cout << ans << endl; }