Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

Why Don't You Guys Believe Him?

By Riaz_BSMRSTU · Limits 1s, 512 MB

My friend, Qbaidul recently claimed again that he is stronger than a Yeti. But this time no one believed him. So, he decided to beat a Yeti for real. He has a team consisting of nn members. Each member has aia_i power.

His team went to the Himalayas to find a Yeti, and they found one too. This Yeti has XX life. If his team wants to beat this Yeti, their total power must be strictly greater than the life of Yeti. If they can't beat this Yeti, Yeti will beat all of them.

Can you tell me whether they will beat this Yeti or not.


First line contains two integers nn (1n101 \le n \le 10), the number of members on his team, and XX (1X1001 \le X \le 100), the life of Yeti.

Next line contains nn integers (0a1,a2,...,an100 \le a_1, a_2, ..., a_n \le 10), where aia_i represents the power of the ithi^th member.


Print Yes\texttt{Yes} if they can beat the Yeti, otherwise print No\texttt{No}.


3 5
1 2 3



97% Solution Ratio

iammarajulEarliest, Apr '20

iammarajulFastest, 0.0s

TusharCSE035Lightest, 0 B

bokaifShortest, 74B


Login to submit


Just sum up the powers and check whether it's greater than Yeti's life or not.

Toph uses cookies. By continuing you agree to our Cookie Policy.