#3394. Distinct Values Splits

Distinct Values Splits

Distinct Values Splits

题目描述

给定一个长度为 n 的整数数组。你的任务是计算将数组划分为若干连续段的方案数,使得每一段都由不同的值组成。

输入格式

第一行有一个整数 n:数组的大小。 下一行有 n 个整数 x_1, x_2,\dots,xnx_n:数组的内容。

输出格式

输出一个整数:问题的答案对 109+710^9 + 7 取模后的值。

4
1 2 1 3
6

提示

1n21051 \le n \le 2 \cdot 10^5 1xi1091 \le x_i \le 10^9 样例解释:共有六种有效的划分:

标签: CSES3190|附加题1

来源

CSES3190|附加题1