题库练习 Moving Dots
← 上一题 下一题 →

A15725 | Moving Dots

时间限制1s
内存限制256MB
通过 / 提交0/0

题目描述

We play a game with $n$ dots on a number line.

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$ ).

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
C++ 编辑器
输入
输出