Codeforces Round 448 (Div. 2)
B
XK Segments
Codeforces
1700
原题
← AC →
翻译中…

While Vasya finished eating his piece of pizza, the lesson has already started. For being late for the lesson, the teacher suggested Vasya to solve one interesting problem. Vasya has an array $*a*$ and integer $*x*$. He should find the number of different ordered pairs of indexes $(*i*, *j*)$ such that $*a*_{*i*} ≤ *a*_{*j*}$ and there are exactly $*k*$ integers $*y*$ such that $*a*_{*i*} ≤ *y* ≤ *a*_{*j*}$ and $*y*$ is divisible by $*x*$.

翻译中…

In this problem it is meant that pair $(*i*, *j*)$ is equal to $(*j*, *i*)$ only if $*i*$ is equal to $*j*$. For example pair $(1, 2)$ is not the same as $(2, 1)$.

翻译中…

Input

翻译中…

The first line contains 3 integers $*n*, *x*, *k*$ ($1 ≤ *n* ≤ 10^{5}, 1 ≤ *x* ≤ 10^{9}, 0 ≤ *k* ≤ 10^{9}$), where $*n*$ is the size of the array $*a*$ and $*x*$ and $*k*$ are numbers from the statement.

翻译中…

The second line contains $*n*$ integers $*a*_{*i*}$ ($1 ≤ *a*_{*i*} ≤ 10^{9}$) — the elements of the array $*a*$.

翻译中…

Output

翻译中…

Print one integer — the answer to the problem.

翻译中…

Note

翻译中…

In first sample there are only three suitable pairs of indexes — $(1, 2), (2, 3), (3, 4)$.

翻译中…

In second sample there are four suitable pairs of indexes$(1, 1), (2, 2), (3, 3), (4, 4)$.

翻译中…

In third sample every pair $(*i*, *j*)$ is suitable, so the answer is $5 * 5 = 25$.

翻译中…

样例

Input #1
4 2 1
1 3 5 7
Output #1
3
InputCopy OutputCopy
Input #2
4 2 0
5 3 1 7
Output #2
4
InputCopy OutputCopy
Input #3
5 3 1
3 3 3 3 3
Output #3
25
InputCopy OutputCopy
题目信息
题号
895B
时间限制
1 s
内存限制
256 MB
标签
二分
数学
排序
双指针

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。