pub fn convolution_i64(a: &[i64], b: &[i64]) -> Vec<i64>
Expand description
Calculates the $(+, \times)$ convolution in i64
.
See the module-level documentation for more details.
Returns a empty Vec
if a
or b
is empty.
§Constraints
- $|a| + |b| - 1 \leq 2^{24}$
- All elements of the result are inside of the range of
i64
§Complexity
- $O(n \log n)$ where $n = |a| + |b|$.
§Example
use proconio::{input, source::once::OnceSource};
input! {
from OnceSource::from(
"3\n\
1 2 3\n\
3\n\
-1 -2 -3\n",
),
a: [i64],
b: [i64],
}
assert_eq!(
ac_library::convolution_i64(&a, &b),
[-1, -4, -10, -12, -9],
);