The Start of the Adventure
Time limit1sMemory limit917 MB
Given N weapons with prices and attack powers, the task is to check whether one affordable weapon has attack power above Huan's S.
- Level
Easy1 of 10
- Topics
- Implementation, Brute force
- Solved
- No attempts yet
Problem
The four-person team Sanjini is leaving PULSE and plans to set off on an adventure with the money they saved in their piggy bank.
To begin the adventure, the team must beat the gatekeeper Huan. To win, they need a weapon with higher attack power than Huan's attack power . Before the fight, the team buys one weapon from a shop that sells weapons. They can buy only one weapon, and they cannot afford any weapon that costs more than their money . Find out whether the team can beat Huan and set off on the adventure.
Input
The first line contains the number of weapons sold in the shop.
The second line contains the money the team has and Huan's attack power , separated by a space.
From the third line to line , the price and attack power of the -th weapon are given, separated by a space.
All given numbers are integers.
Output
Print YES if the team can set off on the adventure, and NO if they cannot.
Hint
PULSE is an algorithm club in the Department of Computer Science and Engineering at Pusan National University, founded in 2015.