cp-library

競技プログラミング用 C++ ライブラリ

View the Project on GitHub qandori/cp-library

:heavy_check_mark: test/cyclic_convolution_light.test.cpp

test/cyclic_convolution_light.test.cpp · GitHub で見る

検証問題

依存ライブラリ

コード

#define PROBLEM "https://yukicoder.me/problems/no/1307"
#include "../convolution/cyclic_convolution_light.hpp"
#include <iostream>
#include <vector>

int main() {
	std::cin.tie(nullptr)->sync_with_stdio(false);
	int n, q;
	std::cin >> n >> q;
	std::vector<long long> a(n), b(n);
	for (auto &x : a) std::cin >> x;
	while (q--) {
		int r;
		std::cin >> r;
		++b[(n - r) % n];
	}
	auto c = light_convolution::cyclic_convolution(a, b, n);
	for (int i = 0; i < n; ++i) std::cout << c[i] << (i + 1 == n ? '\n' : ' ');
}
Back to top page