![]() |
||||||||||
|
||||||||||
Tree FenceTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 236 Accepted Submission(s): 37 Problem Description XEN has a small yard. The yard is square and 1000*1000 large. The lower left corner has coordinates (0, 0), the upper right (1000, 1000). There are N trees in the yard. In order to protect them, XEN wants to fence some of them. XEN can only select some of the M positions which are provided in advance to insert wood piles, then he built fence along the inserted wood piles. Finally, the fence will be a polygon. As the picture below (Data is in the Sample): XEN should pay 47 yuan for each wood pile which were inserted. But he can get 173 yuan from each tree which is in the final polygon. Obviously£¬the income is the difference between the total money he get and the total money he pay. Now XEN want to know the maximum income he will get. But he doesn't know how to calculate it so that he asks your perfect team for help. Can you help him? Input Your program is to read from standard input. In the first line, there are two integer N, M (1 ¡Ü N, M ¡Ü 200), as the description means. The following lines are in the format: the former N lines are the locations of trees, the other M lines are for the M positions. In addition, there is a space between the two numbers of the same line. Tx1 Ty1 Tx2 Ty2 ... Txn Tyn Px1 Py1 Px2 Py2 ... PXm Pym (0 ¡Ü Txi, Tyi, Pxi, Pyi ¡Ü 1000, Integer!) Output Output an integer, the maximum income, in one line (enter is needed). Sample Input
Sample Output
Source | ||||||||||
|