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 r0 = ((next - height).max(0) + b - 1) / b; let r1 = ((next - current).max(0) + b - 1) / b; let s0 = stamina - r0; let s1 = s - r1; if s0 < 0 && s1 < 0 { println!("No"); return; } let h0 = height + r0 * b; let h1 = current + r1 * b; (stamina, height) = if s0 >= 0 && s1 < 0 { (s0, h0) } else if s0 < 0 { (s1, h1) } else { if h0 + s0 * b > h1 + s1 * b { (s0, h0) } else { (s1, h1) } }; } println!("Yes"); }