#P4311. 士兵占领
士兵占领
Description
There is an board, and some cells are obstacles. You need to choose some cells to place soldiers. At most one soldier can be placed in a cell, and soldiers cannot be placed in obstacle cells. We say the soldiers occupy the entire board if, for each row , at least soldiers are placed, and for each column , at least soldiers are placed. Your task is to use the fewest number of soldiers to occupy the entire board.
Input Format
The first line contains three integers , representing the number of rows, the number of columns, and the number of obstacles.
The second line contains integers representing .
The third line contains integers representing .
The next lines each contain two integers , indicating that cell is an obstacle.
Output Format
Output one integer representing the minimum number of soldiers required. If it is impossible to occupy the entire board no matter how many soldiers are placed, output JIONG!.
4 4 4
1 1 1 1
0 1 0 3
1 4
2 2
3 3
4 3
4
Hint
For of the testdata, , .
Translated by ChatGPT 5
京公网安备 11011102002149号