ac-library
ac-library copied to clipboard
add: assert of convolution
Add assert for length of input $|a| + |b|$ in convolution_ll
and convolution_fft
.
https://github.com/atcoder/ac-library/blob/master/document_en/convolution.md?plain=1#L37
The following code should fail on assert
#include <vector>
#include <iostream>
#include <atcoder/convolution>
using namespace std;
using namespace atcoder;
void conv(const int n){
vector<long long> a(n, 1);
vector<long long> b(n, 1);
auto res = convolution<998244353>(a, b);
for(int i = 0; i < 100; ++i) {
cout << i << ": " << res[i] << endl;
}
}
void ll(const int n){
vector<long long> a(n, 1);
vector<long long> b(n, 1);
auto res = convolution_ll(a, b);
for(int i = 0; i < 100; ++i) {
cout << i << ": " << res[i] << endl;
}
}
int main(){
conv(1 << 23);
ll(1 << 24);
}