結果
問題 | No.1304 あなたは基本が何か知っていますか?私は知っています. |
ユーザー | leafirby |
提出日時 | 2021-02-05 18:12:01 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 257 ms / 2,000 ms |
コード長 | 2,105 bytes |
コンパイル時間 | 2,017 ms |
コンパイル使用メモリ | 178,952 KB |
実行使用メモリ | 21,796 KB |
最終ジャッジ日時 | 2024-06-12 17:18:06 |
合計ジャッジ時間 | 35,796 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 110 ms
21,660 KB |
testcase_01 | AC | 151 ms
21,648 KB |
testcase_02 | AC | 109 ms
21,640 KB |
testcase_03 | AC | 257 ms
21,796 KB |
testcase_04 | AC | 111 ms
21,648 KB |
testcase_05 | AC | 110 ms
21,668 KB |
testcase_06 | AC | 111 ms
21,668 KB |
testcase_07 | AC | 111 ms
21,740 KB |
testcase_08 | AC | 189 ms
21,644 KB |
testcase_09 | AC | 112 ms
21,724 KB |
testcase_10 | AC | 110 ms
21,652 KB |
testcase_11 | AC | 112 ms
21,664 KB |
testcase_12 | AC | 112 ms
21,608 KB |
testcase_13 | AC | 111 ms
21,588 KB |
testcase_14 | AC | 111 ms
21,624 KB |
testcase_15 | AC | 111 ms
21,680 KB |
testcase_16 | AC | 111 ms
21,636 KB |
testcase_17 | AC | 153 ms
21,704 KB |
testcase_18 | AC | 112 ms
21,684 KB |
testcase_19 | AC | 112 ms
21,660 KB |
testcase_20 | AC | 113 ms
21,724 KB |
testcase_21 | AC | 154 ms
21,620 KB |
testcase_22 | AC | 112 ms
21,656 KB |
testcase_23 | AC | 112 ms
21,624 KB |
testcase_24 | AC | 111 ms
21,640 KB |
testcase_25 | AC | 227 ms
21,688 KB |
testcase_26 | AC | 186 ms
21,672 KB |
testcase_27 | AC | 186 ms
21,584 KB |
testcase_28 | AC | 192 ms
21,620 KB |
testcase_29 | AC | 187 ms
21,556 KB |
testcase_30 | AC | 217 ms
21,660 KB |
testcase_31 | AC | 227 ms
21,708 KB |
testcase_32 | AC | 187 ms
21,524 KB |
testcase_33 | AC | 223 ms
21,672 KB |
testcase_34 | AC | 187 ms
21,664 KB |
testcase_35 | AC | 217 ms
21,640 KB |
testcase_36 | AC | 226 ms
21,636 KB |
testcase_37 | AC | 216 ms
21,620 KB |
testcase_38 | AC | 215 ms
21,672 KB |
testcase_39 | AC | 245 ms
21,716 KB |
testcase_40 | AC | 215 ms
21,520 KB |
testcase_41 | AC | 246 ms
21,620 KB |
testcase_42 | AC | 220 ms
21,640 KB |
testcase_43 | AC | 218 ms
21,628 KB |
testcase_44 | AC | 222 ms
21,540 KB |
04_evil_A_01 | AC | 262 ms
21,616 KB |
04_evil_A_02 | AC | 225 ms
21,660 KB |
04_evil_A_03 | AC | 249 ms
21,716 KB |
04_evil_A_04 | AC | 223 ms
21,648 KB |
04_evil_A_05 | AC | 228 ms
21,584 KB |
04_evil_A_06 | AC | 116 ms
21,624 KB |
04_evil_A_07 | AC | 114 ms
21,644 KB |
04_evil_A_08 | AC | 115 ms
21,644 KB |
04_evil_A_09 | AC | 112 ms
21,504 KB |
04_evil_A_10 | AC | 114 ms
21,636 KB |
05_evil_B_01 | AC | 281 ms
21,648 KB |
05_evil_B_02 | AC | 276 ms
21,640 KB |
05_evil_B_03 | AC | 281 ms
21,624 KB |
05_evil_B_04 | AC | 282 ms
21,648 KB |
05_evil_B_05 | AC | 280 ms
21,680 KB |
05_evil_B_06 | AC | 279 ms
21,620 KB |
05_evil_B_07 | AC | 276 ms
21,624 KB |
05_evil_B_08 | AC | 276 ms
21,680 KB |
05_evil_B_09 | AC | 283 ms
21,724 KB |
05_evil_B_10 | AC | 286 ms
21,624 KB |
06_evil_C_01 | TLE | - |
06_evil_C_02 | TLE | - |
06_evil_C_03 | TLE | - |
06_evil_C_04 | TLE | - |
06_evil_C_05 | TLE | - |
06_evil_C_06 | TLE | - |
06_evil_C_07 | TLE | - |
06_evil_C_08 | TLE | - |
06_evil_C_09 | TLE | - |
06_evil_C_10 | AC | 74 ms
21,544 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 + mod) % mod * 499122177 % mod; } } } } vector<ll> mul(vector<ll> &mt1, vector<vector<ll>> &mt2) { vector<ll> res(2); res[0] = (mt1[0] * mt2[0][0] % mod + mt1[1] * mt2[0][1] % mod) % mod; res[1] = (mt1[0] * mt2[1][0] % mod + mt1[1] * mt2[1][1] % mod) % mod; return res; } vector<vector<ll>> update(vector<vector<ll>> &mt) { vector<vector<ll>> res(2, vector<ll>(2, 0)); rep(i, 0, 2) rep(j, 0, 2) rep(k, 0, 2) res[i][j] = (res[i][j] + mt[i][k] * mt[k][j] % mod) % mod; return res; } 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(M, vector<ll>(2)); vector<ll> H(M, 0); rep(i, 0, K) { ll A; cin >> A; H[A] = 1; } fwt(H); rep(v, 0, M) dp[v][1] = H[v]; rep(v, 0, M) dp[v][0] = (dp[v][1] * H[v] - K + mod) % mod; rep(v, 0, M) { vector<vector<ll>> mt(2, vector<ll>(2)); mt[0] = {H[v], (1 - K + mod) % mod}; mt[1] = {1, 0}; ll P = N - 1; while(P) { if(P & 1) dp[v] = mul(dp[v], mt); mt = update(mt); P /= 2; } } vector<ll> ep(M); rep(v, 0, M) ep[v] = dp[v][1]; ifwt(ep); ll res = 0; rep(v, X, Y + 1) res = (res + ep[v]) % mod; cout << (res + mod) % mod << endl; }