Subsequence
题号:NC294495
时间限制:C/C++/Rust/Pascal 2秒,其他语言4秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld

题目描述

Given an integer sequence \{a_k\}_{k=1}^n of length n, and two non-negative integers k_1 and k_2, you need to select a subsequence \{b_k\}_{k=1}^m (where m is the length of the subsequence) that satisfies the following conditions:
  1. When i is odd and i>1, \mid b_i-b_{i-1}\mid\le k_1;
  2. When i is a positive even number, \mid b_i-b_{i-1}\mid\ge k_2.
Determine the maximum possible length of such a subsequence.

A subsequence of a is an array formed by deleting some elements from a. This includes deleting zero elements (keeping the entire array) or deleting all elements.

输入描述:

The first line contains three integers n, k_1, and k_2 (1\le n\le 10^60\le k_1,k_2\le 10^6), representing the length of the sequence, the constraint k_1 for the first condition, and the constraint k_2 for the second condition. 

The second line contains n integers a_1,a_2,\ldots,a_n1\le a_i\le 10^6), the given integer sequence.

输出描述:

Output a single integer on a line, representing the maximum length of a valid subsequence.
示例1

输入

复制
5 2 3
4 2 1 3 4

输出

复制
3