311228: CF1952E. Sweep Line

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

E. Sweep Linetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputBe careful not to make a mistake. You might have to start all over again.— Someone, probablyInput

The first line contains one integer $n$ ($1 \leq n \leq 10^5$) — the length of the array $a$.

The second line contains $n$ integers $a_1, a_2, \ldots, a_n$ ($0 \leq a_i \leq 2$) — the array $a$.

Output

Output a single integer — the number of solutions, modulo $20240401$.

ExamplesInput
7
1 1 2 1 1 2 0
Output
1
Input
7
1 1 2 1 1 1 0
Output
2
Input
7
0 1 2 1 1 1 0
Output
0
Note

In the first sample, the array looks like this:

$ \color{blue}{1} $$ \color{blue}{1} $$ \color{darkgreen}{2} $$ \color{blue}{1} $$ \color{blue}{1} $$ \color{darkgreen}{2} $$ \color{gray}{0} $

Obviously, the answer here is $1 \pmod{20240401}$.

In the second sample, the array looks like this:

$ \color{blue}{1} $$ \color{blue}{1} $$ \color{darkgreen}{2} $$ \color{blue}{1} $$ \color{blue}{1} $$ \color{blue}{1} $$ \color{gray}{0} $

I do not know why the answer here is $2 \pmod{20240401}$, I had to take a guess.

In the third sample, the array looks like this:

$ \color{gray}{0} $$ \color{blue}{1} $$ \color{darkgreen}{2} $$ \color{blue}{1} $$ \color{blue}{1} $$ \color{blue}{1} $$ \color{gray}{0} $

If the answer here is not $0 \pmod{20240401}$, I am literally going to explode.

Output

题目大意:
这个问题是关于一个叫做“Sweep Line”(扫描线)的算法问题。题目要求输入一个整数数组,数组长度和数组元素都有一定的限制。需要计算的是,在这个数组中,有多少种解决方案,这个结果需要模上20240401后输出。

输入输出数据格式:
输入:
- 第一行包含一个整数n (1 ≤ n ≤ 10^5),表示数组a的长度。
- 第二行包含n个整数a_1, a_2, …, a_n (0 ≤ a_i ≤ 2),表示数组a的元素。

输出:
- 输出一个整数——解决方案的数量,模20240401。

例如:
输入:
7
1 1 2 1 1 2 0
输出:
1

输入:
7
1 1 2 1 1 1 0
输出:
2

输入:
7
0 1 2 1 1 1 0
输出:
0

请注意,具体的解决方案的数量计算方法没有在题目中详细说明,需要根据问题的具体背景和规则来推断。题目大意: 这个问题是关于一个叫做“Sweep Line”(扫描线)的算法问题。题目要求输入一个整数数组,数组长度和数组元素都有一定的限制。需要计算的是,在这个数组中,有多少种解决方案,这个结果需要模上20240401后输出。 输入输出数据格式: 输入: - 第一行包含一个整数n (1 ≤ n ≤ 10^5),表示数组a的长度。 - 第二行包含n个整数a_1, a_2, …, a_n (0 ≤ a_i ≤ 2),表示数组a的元素。 输出: - 输出一个整数——解决方案的数量,模20240401。 例如: 输入: 7 1 1 2 1 1 2 0 输出: 1 输入: 7 1 1 2 1 1 1 0 输出: 2 输入: 7 0 1 2 1 1 1 0 输出: 0 请注意,具体的解决方案的数量计算方法没有在题目中详细说明,需要根据问题的具体背景和规则来推断。

加入题单

上一题 下一题 算法标签: