#P2794. Facer和教官
Facer和教官
Description
Facer needs to train a team of people.
Each person has an intelligence value and a stamina value .
Facer wants to form teams of two, and the two people in a team should be as similar as possible.
Specifically, the similarity between person and person is . The smaller the similarity, the more similar they are.
There are currently people in the team, but Facer wants to perform operations. There are two types of operations:
- Add a person to the team.
- Given the data of a person who is not in the team, output the minimum similarity between this person and all people in the team. Note that after the operation, do not add this person to the team, and do not remove any person found from the team.
Input Format
The first line contains two integers .
The next lines each contain two numbers , representing the intelligence and stamina of the -th person in the team.
The next lines each describe one operation:
1 a b: A new person with intelligence and stamina is added to the team.2 a b: There is a person not in the team with intelligence and stamina . Output the minimum similarity between this person and all people in the team.
Output Format
For each operation 2, output one line containing the minimum similarity between this person and the most similar person in the team.
3 3
1 7
2 -1
6 6
1 1 5
2 4 5
2 3 0
3
1
Hint
For of the testdata, .
For of the testdata, .
Translated by ChatGPT 5
京公网安备 11011102002149号