Prizes
InterviewTime limit1sMemory limit1024 MB
Given N prize prices and a budget K, determine whether three different prizes have prices that sum to exactly K.
- Level
Medium4 of 10
- Topics
- Array, Sorting, Two pointers
- Solved
- No attempts yet
Problem
Kevin is tasked with buying prizes for the top three finishers of the olympiad final. His budget is euros. He has a list of the prices of possible prizes. Help Kevin determine whether he can buy 3 different prizes so that the budget is spent exactly.
Input
The first line contains two integers () and (), the number of possible prizes and the budget. The second line contains integers (), the prices of the prizes. Some prizes are free.
Output
Print JAH if three different prizes can be chosen so that their total price is exactly . Otherwise, print EI.