2026牛客国庆集训派对day6
A
Bridging the Gap 2
牛客竞赛
未评级
原题
←B →

Bridging the Gap 2官方中文

题目描述

官方中文

A group of $n$ walkers arrives at a riverbank at night. They want to cross the river using a boat, which is initially on their side. The boat can hold at most $R$ walkers at a time and requires at least $L$ $(1 \leq L < R)$ walkers to operate. Rowing the boat is a tiring task. Each time the boat is used to transport a group of walkers to the other side of the river, all walkers on the boat must have stamina greater than $0$, and each walker's stamina decreases by $1$ after the trip. Initially, the $i$-th walker $(1 \leq i \leq n)$ has a stamina value of $h_i$. You need to determine if it is possible to transport all the walkers to the other side of the river using the boat.官方中文

输入格式

官方中文

The first line of input contains three integers $n, L, R$ ($1 \le L < R \le n \le 5 \times 10^5$), denoting the number of walkers, the minimum and the maximum number of walkers to use the boat at a time, respectively.官方中文

The second line of input contains $n$ integers $h_1,h_2,\dots,h_n$ $(1\leq h_i\leq 5\times 10^5)$, where $h_i$ $(1 \leq i \leq n)$ denotes the stamina value of the $i$-th walker.官方中文

输出格式

官方中文

If it is possible to transport all the walkers to the other side of the river using the boat, output "Yes" in the first line (without quotes). Otherwise, output "No" in the first line (without quotes). You can output each letter in any case (lowercase or uppercase). For example, the strings "yEs", "yes", "Yes", and "YES" will all be considered as positive replies.
官方中文

样例

Input #1
4 1 2
1 2 5 10
Output #1
Yes
Input #2
5 1 2
1 1 1 1 5
Output #2
No
Input #3
5 1 3
1 1 1 1 5
Output #3
Yes
Input #4
5 2 3
1 1 1 1 5
Output #4
No
Input #5
9 1 9
1 1 1 1 1 1 1 1 1
Output #5
Yes
题目信息
题号
nc140734pa
时间限制
1 s
内存限制
1024 MB

题面与样例版权归 牛客竞赛 及出题人所有;中文翻译由 AI 生成(官方原文),如有出入请以原文为准。