Blade Tips
InterviewTime limit2sMemory limit1024 MB
Given n tips with values x and y, find the largest subset where every x+y sum is distinct, which is the count of distinct sums.
- Level
Easy3 of 10
- Topics
- Hash map, Implementation
- Solved
- No attempts yet
Problem
Before the battle, Logan concluded that blade tips could greatly raise his chances of winning, so he decided to order a full set.
The set has tips. Nothing in the world is perfect, so each -th tip is described by a pair : the number of abilities it improves and the number it worsens, respectively. Logan decided to choose only part of the set. A subset is called maximally effective if for any two tips and (), the inequality holds.
What is the maximum number of tips that can be chosen so that the subset is maximally effective?
Input
The first line contains a natural number , the number of tips in the original set ().
Each of the next lines contains two integers and , describing the -th tip ().
Output
Print one number, the answer to the problem.