问题 E: Out of Control

内存限制:128 MB 时间限制:2 S 标准输入输出
题目类型:传统 评测方式:文本比较 上传者:
提交:3 通过:3

题目描述

There is a cloud service API to help user store history timestamps. The data structure for each user is initially an empty stack. Every time you post a request to the API with an integer x, denoting the current timestamp, the service will append x to the end of the stack. When x is less than the previous timestamp stored in the stack, the service will think the input is wrong, and will append the previous timestamp instead of x.

You have posted the API for n times, your request timestamp is xi in the i-th call. However, the network is out of control. The service may receive your requests in any arbitrary order, and may even miss some requests. Knowing this issue, you are asking for the on-call engineer to have a look at your stack in the database. Assume the service received exactly k requests, how many possible distinct stacks will it be?

输入格式

The first line contains a single integer T (1T100), the number of test cases. For each test case:

The first line of the input contains a single integer n (1n3,000), denoting the total number of requests.

The second line contains n integers x1,x2,,xn (1xi1e9), denoting the timestamp of each request.

It is guaranteed that the sum of all n is at most 30,000.

输出格式

For each test case, output n lines, the i-th (1in) of which containing an integer, denoting the number of distinct stacks when k=i. Note that the answer may be extremely large, so please print it modulo 109+7 instead.

输入样例 复制

2
3
1 2 3
3
2 3 3

输出样例 复制

3
5
5
2
2
2

分类标签