Wednesday, July 13, 2022

Too Many LIS 2

 This problem has two subtasks worth 

50 points each.

You are given an integer N. You also have N empty sets S1,S2,,SN.

Consider all the arrays A of length N such that 0Ai1 for each 1iN (there are 2N such arrays in total).

For each of these 2N arrays, we compute an array B of length N where Bi= length of longest non-decreasing subsequence for the prefix of length i of array A. (For example: if N=5 and A=[0,1,0,1,1], then B=[1,2,2,3,4].) Next we add the array B to the set SBN (For example, B=[1,2,2,3,4] would be added to S4).

Output the size of sets S1,S2,,SN as N space-separated integers. Since the size of the sets might be large, output the values modulo 109+7.

Note that the Si are sets, and hence do not contain duplicate elements. Please look at the sample cases below for an explained example.

Input Format

  • The first line of input will contain a single integer T, denoting the number of test cases. The description of T test cases follows.
  • The first and only line of each test case contains a single integer N.

Output Format

For each test case, output on a new line the N space separated integers, size of sets S1,S2,,SN, modulo 109+7.

Constraints

  • 1T500
  • 1N2105
  • The sum of N over all tests won't exceed 2105.

Subtasks

Subtask #1 (50 points):

  • 1T100
  • 1N5103
  • The sum of N over all tests won't exceed 5103.

Subtask #2 (50 points): Original constraints

Sample Input 1 

3
2
3
4

Sample Output 1 

1 1
0 2 1
0 2 3 1

Explanation

Test case 1:

  • For A=[0,0]B=[1,2]
  • For A=[0,1]B=[1,2]
  • For A=[1,0]B=[1,1]
  • For A=[1,1]B=[1,2]

Therefore, S1={[1,1]},S2={[1,2]}

Test case 2:

  • For A=[0,0,0]B=[1,2,3]
  • For A=[0,0,1]B=[1,2,3]
  • For A=[0,1,0]B=[1,2,2]
  • For A=[0,1,1]B=[1,2,3]
  • For A=[1,0,0]B=[1,1,2]
  • For A=[1,0,1]B=[1,1,2]
  • For A=[1,1,0]B=[1,2,2]
  • For A=[1,1,1]B=[1,2,3]

Therefore, S1={},S2={[1,1,2],[1,2,2]},S3={[1,2,3]}

Test case 3: 

No comments:

Post a Comment

मुझे दिल में बसाना आसान नहीं....

पता है Recently i realised की मुझे दिल में बसाना आसान नहीं है बात-बात पे चिढ़ जाती हूं मैं दिल लगा लूं एक बार तो फिर ज़िद पे अड़...