use strict; use warnings; use List::Util qw/first max min/; sub gets { chomp(my $line = <>); split / /, $line; } my ($N, $A, $B, $X, $Y) = gets; my @H = gets; while ($A--) { my $maxval = max @H; my $i = first {$H[$_] == $maxval} (0..$N-1); $H[$i] -= $X; } while ($B--) { my $p = $Y; foreach my $i (0..$N-1) { next if ($H[$i] <= 0); my $d = min($p, $H[$i]); $H[$i] -= $d; $p -= $d; } } if (grep {$_ > 0} @H) { print "No\n"; } else { print "Yes\n"; }