Set - MarisaOJ: Marisa Online Judge

Set

Time limit: 1000 ms
Memory limit: 256 MB
Given a sequence of n distinct positive integers a1,a2,…,an, a set S is defined as a subset with the largest possible size from the set {a1,a2,…,an} 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 109+7. #### Input - The first line contains two integers n and m (1≤n,m≤100). - The second line contains n positive integers a1,a2,…,an (1≤ai≤106). #### 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 109+7. #### Example Input: 210012 Output: 12 #### Subtasks - **Subtask 1 (50 points)**: ai≤10. - **Subtask 2 (40 points)**: n≤1000,ai≤106. - **Subtask 3 (10 points)**: n=1 (in this case, the input file contains only one line with two integers n and m).