#P7375. [COCI 2018/2019 #5] Jarvis
[COCI 2018/2019 #5] Jarvis
Description
Ivan has drones. Each drone has a factory attribute value and a required attribute value for deployment. He can choose an integer ( is not necessarily positive) and add to the factory attribute value of every drone.
Find the maximum number of drones that can be deployed (that is, whose attribute value becomes equal to the required attribute value for deployment).
Input Format
The first line contains an integer , the number of drones.
The second line contains integers , the factory attribute values of the drones.
The third line contains integers , the required attribute values for deployment of the drones.
Output Format
Output the maximum number of drones that can be deployed.
1
1
2
1
2
0 0
1 1
2
2
1 2
5 5
1
Hint
Explanation for Sample 3
If we choose , the attribute values become and , so only the second drone can be deployed. If , the attribute values become and , so only the first drone can be deployed. It can be proven that there is no integer that allows both drones to be deployed.
Constraints
For of the testdata, .
For of the testdata, , .
Notes
The score of this problem follows the original COCI setting, with a full score of .
Translated from COCI2018-2019 CONTEST #5 T2 Jarvis.
Translated by ChatGPT 5
京公网安备 11011102002149号