結果
問題 | No.1304 あなたは基本が何か知っていますか?私は知っています. |
ユーザー | leafirby |
提出日時 | 2021-02-03 00:47:10 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 84 ms / 2,000 ms |
コード長 | 1,417 bytes |
コンパイル時間 | 2,016 ms |
コンパイル使用メモリ | 175,736 KB |
実行使用メモリ | 70,880 KB |
最終ジャッジ日時 | 2024-06-12 16:38:33 |
合計ジャッジ時間 | 7,975 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 26 ms
13,544 KB |
testcase_01 | AC | 30 ms
17,524 KB |
testcase_02 | AC | 25 ms
13,548 KB |
testcase_03 | AC | 84 ms
70,880 KB |
testcase_04 | AC | 25 ms
13,552 KB |
testcase_05 | AC | 25 ms
13,556 KB |
testcase_06 | AC | 25 ms
13,544 KB |
testcase_07 | AC | 26 ms
13,428 KB |
testcase_08 | AC | 34 ms
21,760 KB |
testcase_09 | AC | 26 ms
13,428 KB |
testcase_10 | AC | 25 ms
13,556 KB |
testcase_11 | AC | 25 ms
13,424 KB |
testcase_12 | AC | 26 ms
13,548 KB |
testcase_13 | AC | 25 ms
13,424 KB |
testcase_14 | AC | 25 ms
13,424 KB |
testcase_15 | AC | 25 ms
13,548 KB |
testcase_16 | AC | 26 ms
13,548 KB |
testcase_17 | AC | 30 ms
17,652 KB |
testcase_18 | AC | 26 ms
13,556 KB |
testcase_19 | AC | 25 ms
13,424 KB |
testcase_20 | AC | 25 ms
13,416 KB |
testcase_21 | AC | 29 ms
17,660 KB |
testcase_22 | AC | 25 ms
13,552 KB |
testcase_23 | AC | 25 ms
13,552 KB |
testcase_24 | AC | 26 ms
13,424 KB |
testcase_25 | AC | 47 ms
33,920 KB |
testcase_26 | AC | 34 ms
21,632 KB |
testcase_27 | AC | 34 ms
21,760 KB |
testcase_28 | AC | 37 ms
25,868 KB |
testcase_29 | AC | 34 ms
21,760 KB |
testcase_30 | AC | 42 ms
29,968 KB |
testcase_31 | AC | 54 ms
42,280 KB |
testcase_32 | AC | 34 ms
21,760 KB |
testcase_33 | AC | 46 ms
34,072 KB |
testcase_34 | AC | 33 ms
21,756 KB |
testcase_35 | AC | 42 ms
29,968 KB |
testcase_36 | AC | 50 ms
38,044 KB |
testcase_37 | AC | 42 ms
30,092 KB |
testcase_38 | AC | 42 ms
29,840 KB |
testcase_39 | AC | 59 ms
46,384 KB |
testcase_40 | AC | 42 ms
29,840 KB |
testcase_41 | AC | 59 ms
46,384 KB |
testcase_42 | AC | 43 ms
29,972 KB |
testcase_43 | AC | 43 ms
29,968 KB |
testcase_44 | AC | 50 ms
38,176 KB |
04_evil_A_01 | AC | 84 ms
71,008 KB |
04_evil_A_02 | AC | 52 ms
38,180 KB |
04_evil_A_03 | AC | 60 ms
46,384 KB |
04_evil_A_04 | AC | 47 ms
34,072 KB |
04_evil_A_05 | AC | 50 ms
38,048 KB |
04_evil_A_06 | AC | 26 ms
13,552 KB |
04_evil_A_07 | AC | 26 ms
13,548 KB |
04_evil_A_08 | AC | 25 ms
13,556 KB |
04_evil_A_09 | AC | 26 ms
13,416 KB |
04_evil_A_10 | AC | 26 ms
13,548 KB |
05_evil_B_01 | AC | 104 ms
71,012 KB |
05_evil_B_02 | AC | 98 ms
71,012 KB |
05_evil_B_03 | AC | 104 ms
71,008 KB |
05_evil_B_04 | AC | 105 ms
70,888 KB |
05_evil_B_05 | AC | 102 ms
71,012 KB |
05_evil_B_06 | AC | 100 ms
71,012 KB |
05_evil_B_07 | AC | 98 ms
70,884 KB |
05_evil_B_08 | AC | 99 ms
71,012 KB |
05_evil_B_09 | AC | 104 ms
71,016 KB |
05_evil_B_10 | AC | 109 ms
71,012 KB |
06_evil_C_01 | RE | - |
06_evil_C_02 | RE | - |
06_evil_C_03 | RE | - |
06_evil_C_04 | RE | - |
06_evil_C_05 | RE | - |
06_evil_C_06 | RE | - |
06_evil_C_07 | RE | - |
06_evil_C_08 | RE | - |
06_evil_C_09 | RE | - |
06_evil_C_10 | AC | 24 ms
11,500 KB |
ソースコード
#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 mod 998244353 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) * 499122177 % mod, f[j | i] = (x - y) * 499122177 % mod; } } } } int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); ll N, K, X, Y; cin >> N >> K >> X >> Y; ll M = 262144; vector<vector<ll>> dp(N + 2, vector<ll>(M, 1)); vector<ll> H(M, 0); rep(i, 0, K) { ll A; cin >> A; H[A] = 1; } fwt(H); rep(v, 0, M) dp[1][v] = dp[0][v] * H[v]; rep(v, 0, M) dp[2][v] = dp[1][v] * H[v] - K * dp[0][v]; rep(i, 3, N + 1) rep(v, 0, M) dp[i][v] = (dp[i - 1][v] * H[v] - (K - 1) * dp[i - 2][v] + mod) % mod; ifwt(dp[N]); ll res = 0; rep(v, 0, M) if(X <= v & v <= Y) res = (res + dp[N][v]) % mod; cout << (res + mod) % mod << endl; }