#Lutece0891. Diagrams & Tableaux
Diagrams & Tableaux
Migrated from Lutece 891 Diagrams & Tableaux
All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.
Description
A Young diagram is an arrangement of boxes in rows and columns conforming to the following rules:
- the boxes in each row and each column are contiguous,
- the left borders of all rows are aligned, and
- each row is not longer than the one above.
Here are some examples of Young diagrams:
A semi-standard Young tableau for a given number is a Young diagram that has its boxes filled according to the following rules:
- Each box contains a single integer between and , inclusive,
- each integer is greater than or equal to the integer in the box to its left, and
- each integer is strictly greater than the integer in the box above.
Here is a list of all semi-standard Young tableaux for , based on a particular Young diagram:
Your task is to count how many semi-standard Young tableaux are possible, based on a given Young diagram, with a given .
Input
Each test case consists of two lines. The first line of each test case specifies the Young diagram. This line starts with the number satisfying , the number of rows, followed by positive integers . These integers specify the number of boxes on each row of the Young diagram, and they satisfy . The second line contains the integer , satisfying .
Output
For each test case, print one line containing the number of semi-standard Young tableaux based on the given Young diagram, with the given .
Samples
1 1
1
1 1
2
2 2 1
4
4 3 2 1 1
4
1
2
20
20
Resources
Northwestern European Regional Contest 2013