| 31 | } |
| 32 | } |
| 33 | void iwt(int* a, int n, int flag = XOR) { |
| 34 | if (n == 0) return; |
| 35 | int m = n / 2; |
| 36 | iwt(a, m, flag); iwt(a + m, m, flag); |
| 37 | for (int i = 0; i < m; i++){ |
| 38 | int x = a[i], y = a[i + m]; |
| 39 | if (flag == OR) a[i] = x, a[i + m] = (y - x + mod) % mod; |
| 40 | if (flag == AND) a[i] = (x - y + mod) % mod, a[i + m] = y; |
| 41 | if (flag == XOR) a[i] = 1LL * (x + y) * inv2 % mod, a[i + m] = 1LL * (x - y + mod) * inv2 % mod; // replace inv2 by >>1 if not required |
| 42 | } |
| 43 | } |
| 44 | vector<int> multiply(int n, vector<int> A, vector<int> B, int flag = XOR) { |
| 45 | assert(__builtin_popcount(n) == 1); |
| 46 | A.resize(n); B.resize(n); |
nothing calls this directly
no outgoing calls
no test coverage detected