#P7559. [JOISC 2021] IOI 熱の感染拡大 (Day1)
[JOISC 2021] IOI 熱の感染拡大 (Day1)
Description
In the JOI Kingdom, there are palaces. The -th palace is located at . Each palace is home to one prince; the prince in the -th palace is Prince . Starting from time , every prince will leave their own palace and start moving. They can choose one of the four directions: east, south, west, or north.
- If they choose east, then after time , their position changes from to .
- If they choose west, then after time , their position changes from to .
- If they choose south, then after time , their position changes from to .
- If they choose north, then after time , their position changes from to .
does not have to be an integer.
The directions will not be given; you can plan them yourself.
Unfortunately, Prince has been infected with the IOVID-114514 virus, and at time , only Prince is infected.
The IOVID-114514 virus spreads in the following way:
- If at some time, Prince and Prince are at the same coordinate, and Prince is infected while Prince is not, then Prince will infect Prince .
The IOVID-114514 virus has no other way of spreading, and the poor King JOI 114514 has not found any cure.
(Disinfectant cannot cure it either.)
King JOI 114514 wants you to find the maximum number of princes that can be infected by time .
Input Format
The first line contains an integer , representing the number of palaces.
The next lines each contain two integers , representing the coordinates of a palace.
Output Format
Output one integer on a single line, representing the answer.
2
0 0
4 3
1
3
1 2
2 1
4 3
3
2
20 20
20 21
2
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
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
Hint
Explanation of Sample 1

We plan Prince to move east, and Prince to move west.
It is not hard to see that no matter how they move, Prince can never meet Prince , so only Prince is infected.
Explanation of Sample 2

We plan Prince to move east, Prince to move north, and Prince to move west.
- At time , Prince is infected.
- At time , Prince and Prince are at the same coordinate, so Prince becomes infected.
- At time , Prince and Prince are at the same coordinate, so Prince becomes infected.
Explanation of Sample 3
We plan Prince to move north, and Prince to move south.
- At time , Prince is infected.
- At time , Prince and Prince are at the same coordinate, so Prince becomes infected.
Constraints and Notes
This problem uses bundled testdata.
- Subtask 1 (5 pts): , satisfies Property A.
- Subtask 2 (8 pts): , satisfies Property A.
- Subtask 3 (6 pts): , satisfies Properties A and B.
- Subtask 4 (6 pts): , satisfies Property A.
- Subtask 5 (12 pts): .
- Subtask 6 (32 pts): satisfies Property A.
- Subtask 7 (31 pts): no special restrictions.
For of the testdata: , , and all palace coordinates are distinct.
The properties are:
- Property A: , .
- Property B: the coordinate of Palace is the origin.
Notes
Translated from The 20th Japanese Olympiad in Informatics Spring Training Camp, Day1 B IOI 熱の感染拡大 (IOI Fever) English version.
Translated by ChatGPT 5
京公网安备 11011102002149号