結果
問題 | No.1304 あなたは基本が何か知っていますか?私は知っています. |
ユーザー | SSRS |
提出日時 | 2020-12-02 00:27:33 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 53 ms / 2,000 ms |
コード長 | 1,656 bytes |
コンパイル時間 | 1,638 ms |
コンパイル使用メモリ | 175,504 KB |
実行使用メモリ | 11,904 KB |
最終ジャッジ日時 | 2024-06-12 13:32:29 |
合計ジャッジ時間 | 9,968 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 47 ms
11,776 KB |
testcase_01 | AC | 45 ms
11,776 KB |
testcase_02 | AC | 46 ms
11,776 KB |
testcase_03 | AC | 48 ms
11,776 KB |
testcase_04 | AC | 53 ms
11,776 KB |
testcase_05 | AC | 47 ms
11,776 KB |
testcase_06 | AC | 48 ms
11,648 KB |
testcase_07 | AC | 47 ms
11,776 KB |
testcase_08 | AC | 48 ms
11,776 KB |
testcase_09 | AC | 46 ms
11,776 KB |
testcase_10 | AC | 46 ms
11,776 KB |
testcase_11 | AC | 46 ms
11,776 KB |
testcase_12 | AC | 48 ms
11,776 KB |
testcase_13 | AC | 47 ms
11,904 KB |
testcase_14 | AC | 47 ms
11,776 KB |
testcase_15 | AC | 46 ms
11,648 KB |
testcase_16 | AC | 48 ms
11,776 KB |
testcase_17 | AC | 47 ms
11,776 KB |
testcase_18 | AC | 47 ms
11,776 KB |
testcase_19 | AC | 47 ms
11,776 KB |
testcase_20 | AC | 45 ms
11,648 KB |
testcase_21 | AC | 47 ms
11,776 KB |
testcase_22 | AC | 47 ms
11,776 KB |
testcase_23 | AC | 48 ms
11,776 KB |
testcase_24 | AC | 49 ms
11,776 KB |
testcase_25 | AC | 47 ms
11,648 KB |
testcase_26 | AC | 46 ms
11,776 KB |
testcase_27 | AC | 47 ms
11,776 KB |
testcase_28 | AC | 47 ms
11,776 KB |
testcase_29 | AC | 47 ms
11,776 KB |
testcase_30 | AC | 47 ms
11,776 KB |
testcase_31 | AC | 46 ms
11,648 KB |
testcase_32 | AC | 47 ms
11,776 KB |
testcase_33 | AC | 46 ms
11,648 KB |
testcase_34 | AC | 46 ms
11,904 KB |
testcase_35 | AC | 45 ms
11,776 KB |
testcase_36 | AC | 46 ms
11,776 KB |
testcase_37 | AC | 46 ms
11,648 KB |
testcase_38 | AC | 49 ms
11,776 KB |
testcase_39 | AC | 49 ms
11,648 KB |
testcase_40 | AC | 50 ms
11,776 KB |
testcase_41 | AC | 51 ms
11,776 KB |
testcase_42 | AC | 49 ms
11,776 KB |
testcase_43 | AC | 47 ms
11,776 KB |
testcase_44 | AC | 48 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; A[j | (1 << i)] = x - y; if (inv){ A[j] /= 2; A[j | (1 << i)] /= 2; } } } } 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]; } C = fwt(C, N, true); return C; } int main(){ int N, K, X, Y; cin >> N >> K >> X >> Y; Y = min(Y, 1023); vector<int> A(K); for (int i = 0; i < K; i++){ cin >> A[i]; } 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 = 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; }