#P4068. [SDOI2016] 数字配对
[SDOI2016] 数字配对
Description
There are types of numbers. For the -th type, the number is , there are copies of it, and its weight is .
If two numbers and satisfy that is a multiple of , and is a prime number, then these two numbers can be paired, gaining a value of .
Each number can participate in at most one pairing, and it is allowed to remain unpaired.
Under the condition that the total gained value is at least , find the maximum possible number of pairings.
Input Format
The first line contains an integer .
The second line contains integers .
The third line contains integers .
The fourth line contains integers .
Output Format
Output a single integer on one line: the maximum number of pairings.
3
2 4 8
2 200 7
-1 -2 1
4
Hint
Test points : , , , .
Test points : , , , .
Test points : , , , .
Translated by ChatGPT 5
京公网安备 11011102002149号