loj#P3488. 「JOISC 2021 Day1」IOI 热病
「JOISC 2021 Day1」IOI 热病
Description
Original problem at JOISC 2021 Day1 T2 IOI Fever
JOI Kingdom is represented by a xy-plane. There are houses in JOI Kingdom numbered from to . The coordinate of the house is . Different houses have different coordinates. A citizen lives in each house. The citizen in the house is called the citizen . A long holiday season begins in JOI Kingdom. At time , every citizen leaves the house, and starts traveling.
In the beginning, every citizen chooses one of east
, west
, south
, north
, which is the direction for traveling.
The citizens will travel in the following way.
- If the citizen chooses
east
, the citizen moves along the -axis toward the positive direction with speed . In other words, at time , the coordinates of the citizen becomes . - If the citizen chooses
west
, the citizen moves along the -axis toward the negative direction with speed . In other words, at time , the coordinates of the citizen becomes . - If the citizen chooses
south
, the citizen moves along the -axis toward the negative direction with speed . In other words, at time , the coordinates of the citizen becomes . - If the citizen chooses
north
, the citizen moves along the -axis toward the positive direction with speed . In other words, at time , the coordinates of the citizen becomes .
Unfortunately, at time , the citizen is infected with IOI fever, which is a newly discovered infectious disease. At time , there are no infected people other than the citizen . The IOI fever is transmitted among citizens in the following way.
- Assume that, at a certain time, the citizen and the citizen have the same coordinates, the citizen is infected with IOI fever, and the citizen b is not infected with IOI fever. Then, the citizen becomes infected with IOI fever.
The IOI fever is not transmitted by other methods. Moreover, since IOI fever is an incurable disease, infected citizen will not be recovered.
As a minister of JOI Kingdom, you need to estimate how many citizens will be infected with IOI fever if the citizens make the worst possible choice.
Write a program which, given the number of houses and the coordinate of each house, calculates the largest possible number of infected citizens at time .
Input Format
In the first line, there is a only integer .
In the following lines, there are two integers and in each line.
Output Format
Write one line to the standard output. Output the largest possible number of infected citizens at time .
2
0 0
4 3
1
3
1 2
2 1
4 3
3
15
5 6
2 9
12 0
4 11
3 12
6 5
0 8
9 10
11 13
8 7
13 2
1 1
7 14
10 4
14 3
9
2
20 20
20 21
2
30
275810186 246609547
122805872 99671769
243507947 220373844
281305347 252104708
237805644 214671541
172469077 149334974
222589229 229887956
160653451 208404690
241378966 211098219
144302355 224755786
186392385 163258282
199129390 169928751
294937491 265736852
196096122 172962019
314342944 285142305
202720470 166337671
157037485 133903382
263858979 240724876
210720220 181519581
296402036 267201397
186021287 183036854
195081930 173976211
328293029 299092390
261195361 238061258
323595085 294394446
299933764 270733125
240976723 128081418
188501753 165367650
277832422 248631783
119896220 96762117
11
Constraints
For all test data, it is guaranteed that .
Subtask | Score | Additional Constraints |
---|---|---|
No additional constraints |