#P7375. Maximize Battle-Ready Drones
Maximize Battle-Ready Drones
Maximize Battle-Ready Drones
Ivan owns (N) drones. Each drone has an initial (factory) attribute value, denoted by (a_i), and a battle requirement attribute value, denoted by (b_i). Ivan can choose an integer (X) (which can be non-positive) and add it to the initial attribute value of every drone. After this adjustment, a drone is ready for battle if its new attribute value equals its battle requirement, i.e., if (a_i + X = b_i).
The task is to determine the maximum number of drones that can be battle-ready (i.e. (a_i + X = b_i)) by choosing an appropriate (X).
Notice that for a particular drone, to be battle-ready, the chosen (X) must be (b_i - a_i). Therefore, the answer is the maximum frequency of a specific value (b_i - a_i) among all drones.
inputFormat
The first line contains a single integer (N), the number of drones. Each of the following (N) lines contains two space-separated integers (a_i) and (b_i) representing the initial attribute value and the battle requirement attribute value of the (i)-th drone respectively.
outputFormat
Output a single integer, the maximum number of drones that can be made battle-ready by choosing an appropriate integer (X).
sample
3
1 3
2 4
3 5
3