AT_agc078_b.L Robust IS
NOI/NOI+/CTSC
通过率:0%
时间限制:2.00s
内存限制:1024MB
AC君温馨提醒
该题目为【atcoder】题库的题目,您提交的代码将被提交至atcoder进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
You are given a length-N sequence of positive integers A=(A1,A2,…,AN) and non-negative integers X,Y.
Find the maximum length M of a subsequence B=(B1,B2,…,BM) of A that satisfies both of the following conditions.
- Bi≥Bi−1−X holds for every integer i satisfying 2≤i≤M.
- Bi≥Bi−2−(X+Y) holds for every integer i satisfying 3≤i≤M.
给定一个长度为 N 的正整数序列 A=(A1,A2,…,AN),以及两个非负整数 X,Y。
求满足以下两个条件的 A 的子序列 B=(B1,B2,…,BM) 的最大长度 M:
- 对每个满足 2≤i≤M 的整数 i,均有 Bi≥Bi−1−X;
- 对每个满足 3≤i≤M 的整数 i,均有 Bi≥Bi−2−(X+Y)。
输入格式
The input is given from Standard Input in the following format:
N X Y
A1 A2 … AN
输入从标准输入中按以下格式给出:
N X Y
A1 A2 … AN
输出格式
Output the answer.
输出答案。
输入输出样例
输入#1
7 3 1 8 6 3 7 5 2 6
输出#1
5
输入#2
5 0 0 5 4 3 2 1
输出#2
1
输入#3
15 441943320 890669835 693547414 783888993 702664735 345257171 73365711 320257375 683236857 951712144 151653382 210806164 439829968 987667432 978973992 565844495 621822141
输出#3
13
说明/提示
Sample 1 Explanation:
The subsequence (8,6,7,5,6) satisfies the conditions. There is no subsequence of length 6 or greater that satisfies the conditions, so output 5.
Constraints
- 1≤N≤5×105
- 1≤Ai≤109
- 0≤X,Y≤109
- All input values are integers.
样例 1 解释:
子序列 (8,6,7,5,6) 满足条件。不存在长度为 6 或更大的满足条件的子序列,因此输出 5。
约束条件
- 1≤N≤5×105
- 1≤Ai≤109
- 0≤X,Y≤109
- 所有输入值均为整数。
输入解题思路,AI测评打分。不知道怎么写?