[BOJ 27490] Moving Dots
View as PDFWe play a game with $n$ dots on a number line.</p>
The initial coordinate of the $i$-th dot is $x_i$. These coordinates are distinct. Every dot starts moving simultaneously with the same constant speed.
Each dot moves in the direction of the closest dot (different from itself) until it meets another dot. In the case of a tie, it goes to the left. Two dots meet if they are in the same coordinate, after that, they stop moving.
After enough time, every dot stops moving. The result of a game is the number of distinct coordinates where the dots stop.
Because this game is too easy, calculate the sum of results when we play the game for every subset of the given $n$ dots that has at least two dots. As the result can be very large, print the sum modulo $10^9+7$.
입력 형식
The first line contains one integer $n$ ($2 \leq n \leq 3000$).</p>
The next line contains $n$ integers $x_1, x_2, \ldots, x_n$ ($1 \leq x_1 < x_2 < \ldots < x_n \leq 10^9$), where $x_i$ represents the initial coordinate of $i$-th dot.
출력 형식
Print the sum of results modulo $10^9+7$.
예제 입력 1
4
1 2 4 6
예제 출력 1
11
예제 입력 2
5
1 3 5 11 15
예제 출력 2
30
Comments