結果
問題 | No.1304 あなたは基本が何か知っていますか?私は知っています. |
ユーザー | SSRS |
提出日時 | 2020-12-02 00:38:14 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 28 ms / 2,000 ms |
コード長 | 1,469 bytes |
コンパイル時間 | 2,603 ms |
コンパイル使用メモリ | 191,920 KB |
実行使用メモリ | 11,776 KB |
最終ジャッジ日時 | 2024-06-12 13:35:13 |
合計ジャッジ時間 | 8,621 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 9 ms
11,520 KB |
testcase_01 | AC | 9 ms
11,648 KB |
testcase_02 | AC | 10 ms
11,648 KB |
testcase_03 | AC | 12 ms
11,648 KB |
testcase_04 | AC | 12 ms
11,776 KB |
testcase_05 | AC | 10 ms
11,776 KB |
testcase_06 | AC | 12 ms
11,648 KB |
testcase_07 | AC | 10 ms
11,776 KB |
testcase_08 | AC | 12 ms
11,776 KB |
testcase_09 | AC | 10 ms
11,776 KB |
testcase_10 | AC | 9 ms
11,648 KB |
testcase_11 | AC | 8 ms
11,776 KB |
testcase_12 | AC | 10 ms
11,648 KB |
testcase_13 | AC | 9 ms
11,648 KB |
testcase_14 | AC | 10 ms
11,776 KB |
testcase_15 | AC | 9 ms
11,776 KB |
testcase_16 | AC | 10 ms
11,648 KB |
testcase_17 | AC | 11 ms
11,648 KB |
testcase_18 | AC | 10 ms
11,776 KB |
testcase_19 | AC | 9 ms
11,776 KB |
testcase_20 | AC | 9 ms
11,648 KB |
testcase_21 | AC | 13 ms
11,776 KB |
testcase_22 | AC | 11 ms
11,776 KB |
testcase_23 | AC | 12 ms
11,776 KB |
testcase_24 | AC | 10 ms
11,776 KB |
testcase_25 | AC | 9 ms
11,648 KB |
testcase_26 | AC | 11 ms
11,776 KB |
testcase_27 | AC | 25 ms
11,648 KB |
testcase_28 | AC | 10 ms
11,648 KB |
testcase_29 | AC | 11 ms
11,776 KB |
testcase_30 | AC | 9 ms
11,776 KB |
testcase_31 | AC | 9 ms
11,648 KB |
testcase_32 | AC | 28 ms
11,648 KB |
testcase_33 | AC | 9 ms
11,776 KB |
testcase_34 | AC | 24 ms
11,776 KB |
testcase_35 | AC | 8 ms
11,776 KB |
testcase_36 | AC | 8 ms
11,776 KB |
testcase_37 | AC | 10 ms
11,648 KB |
testcase_38 | AC | 10 ms
11,520 KB |
testcase_39 | AC | 9 ms
11,648 KB |
testcase_40 | AC | 11 ms
11,776 KB |
testcase_41 | AC | 12 ms
11,648 KB |
testcase_42 | AC | 10 ms
11,776 KB |
testcase_43 | AC | 11 ms
11,648 KB |
testcase_44 | AC | 11 ms
11,648 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 | - |
ソースコード
#pragma GCC target("avx2") #pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #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]); } } } } 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[j] %= MOD; } } long long ans = 0; for (int i = 0; i < 1024; i++){ for (int j = 0; j < 1024; j++){ if (X <= (i ^ j) && (i ^ j) <= Y){ ans += sum[i] * sum[j]; ans %= MOD; } } } for (int i = 0; i < 1024; i++){ vector<int> f; for (int j = 0; j < 1024; j++){ if (H[i][j] > 0){ f.push_back(j); } } int cnt = f.size(); for (int j = 0; j < cnt; j++){ for (int k = 0; k < cnt; k++){ if (X <= (f[j] ^ f[k]) && (f[j] ^ f[k]) <= Y){ ans += MOD - H[i][f[j]] * H[i][f[k]] % MOD; ans %= MOD; } } } } cout << ans << endl; }