use proconio::input; fn main() { input! { n: i64, s: i64, b: i64, h: [i64; n] } let (mut stamina, mut height) = (s, h[0]); for w in h.windows(2) { let (current, next) = (w[0], w[1]); let s0 = ((next - height).max(0) + b - 1) / b; let s1 = ((next - current).max(0) + b - 1) / b; if s0 > stamina && s1 > s { println!("No"); return; } (stamina, height) = if stamina - s0 > s - s1 { (stamina - s0, height + s0 * b) } else { (s - s1, current + s1 * b) }; } println!("Yes"); }