Set - MarisaOJ: Marisa Online Judge

Set

Time limit: 1000 ms
Memory limit: 256 MB
Given a sequence of $n$ distinct positive integers $a_1, a_2, \ldots, a_n$, a set $S$ is defined as a subset with the largest possible size from the set $\{a_1, a_2, \ldots, a_n\}$ such that if $x$ is in $S$, then $x + 1$ is not in $S$. **Objective**: Given $n$ and the sequence $a$, determine the size of the set $S$ and the number of distinct ways to choose $S$, modulo $10^9 + 7$. #### Input - The first line contains two integers $n$ and $m$ $(1 \leq n, m \leq 100)$. - The second line contains $n$ positive integers $a_1, a_2, \ldots, a_n$ $(1 \leq a_i \leq 10^6)$. #### Output - Output a single line containing two integers $k$ and $c$, where $k$ is the size of the set $S$ and $c$ is the number of distinct ways to choose the set $S$ modulo $10^9 + 7$. #### Example Input: ``` 2 100 1 2 ``` Output: ``` 1 2 ``` #### Subtasks - **Subtask 1 (50 points)**: $a_i \leq 10$. - **Subtask 2 (40 points)**: $n \leq 1000, a_i \leq 10^6$. - **Subtask 3 (10 points)**: $n = 1$ (in this case, the input file contains only one line with two integers $n$ and $m$).