CF444B DZY Loves FFT

题目描述

### 题目背景 *DZY 喜欢快速傅里叶变换,并乐于使用它。* [快速傅里叶变换](https://oi-wiki.org/math/poly/fft/)是一种计算卷积的算法。如果 $a$,$b$,$c$ 均为下标从 $0$ 到 $n-1$ 的序列,并且 $c_i = \sum_{j=0}^i a_j \times b_{i-j}$,就可以用快速傅里叶变换来计算 $c$。 DZY 把上面这个式子变成了 $c_i = \max_{j=0}^i a_j \times b_{i-j}$。 其中,$a$ 是从 $1$ 到 $n$ 的**排列**,$b$ 是 $01$ 序列,下标从 $0$ 到 $n-1$。 DZY 需要你计算序列 $c$。 但 DZY 很调皮,他提供了一种方法来得到 $a$ 和 $b$。给定三个整数 $n$,$d$,$x$,使用下面的代码生成 $a$ 和 $b$。 ```cpp //x 为 long long 类型 long long getNextX(){ x=(x*37+10007)%1000000007; return x; } void initAB(){ for(int i=0;i

输入格式

输出格式

说明/提示

In the first sample, $ a $ is $ [1\ 3\ 2] $ , $ b $ is $ [1\ 0\ 0] $ , so $ c_{0}=max(1·1)=1 $ , $ c_{1}=max(1·0,3·1)=3 $ , $ c_{2}=max(1·0,3·0,2·1)=2 $ . In the second sample, $ a $ is $ [2\ 1\ 4\ 5\ 3] $ , $ b $ is $ [1\ 1\ 1\ 0\ 1] $ . In the third sample, $ a $ is $ [5\ 2\ 1\ 4\ 3] $ , $ b $ is $ [1\ 1\ 1\ 1\ 0] $ .