#abc226b. B - Counting Arrays
B - Counting Arrays
Score : points
问题描述
给定从 到 编号的 个序列。
第 个序列的长度为 ,其第 个元素 为 。
若满足以下条件,则认为序列 和序列 相同: 且对于所有 ,有 。
请问从序列 到序列 中有多少种不同的序列?
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
You are given sequences numbered to .
Sequence has a length of and its -th element is .
Sequence and Sequence are considered the same when and for every .
How many different sequences are there among Sequence through Sequence ?
Constraints
- The total number of elements in the sequences, , does not exceed .
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the number of different sequences.
Sample Input 1
4
2 1 2
2 1 1
2 2 1
2 1 2
Sample Output 1
3
Sample Input contains four sequences:
- Sequence :
- Sequence :
- Sequence :
- Sequence :
Except that Sequence and Sequence are the same, these sequences are pairwise different, so we have three different sequences.
Sample Input 2
5
1 1
1 1
1 2
2 1 1
3 1 1 1
Sample Output 2
4
Sample Input contains five sequences:
- Sequence :
- Sequence :
- Sequence :
- Sequence :
- Sequence :
Sample Input 3
1
1 1
Sample Output 3
1
update @ 2024/3/10 09:54:49
相关
在下列比赛中: