|
||||||||||
Moving the MouseTime Limit: 20000/8000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 124 Accepted Submission(s): 1 Problem Description You know when playing computer games, the mouse is very important. Someone is such a slovenly boy. His desk on which he puts many things is really a mess. For playing games well, he should be able to use the mouse to reach everywhere on screen. His screen¡¯s shape is very strange. It¡¯s a convex polygon so that in order to reach everywhere on screen, he should be able to move his mouse at least everywhere within a convex polygon on the desk. He is too lazy to clean his desk, so he wonders if there is enough space to use his mouse. Can you help him find out if there is enough space? Put it another way, you should find out whether it is possible to put the convex polygon the mouse needs at least on the desk without any intersections with any other things. You may assume the mouse is just a point and cannot rotate. You may also assume all the things on his desk are convex polygons. Note that these polygons may intersect each other; the mouse can be everywhere on the desk but not be strictly inside any convex polygon of something. You will be given the convex polygons of all the things on his desk and the convex polygon the mouse needs at least. Input The first line contains a single integer T, indicating the number of test cases. Each test case begins with three integers X, Y, and N. The desk¡¯s lower left coordinates are always (0, 0) and its upper right coordinates are (X, Y). N indicates the number of things on his desk. Then one line follows. This line contains an integer M followed by M pairs of integers. Each of the pair indicates a vertex of the convex polygon the mouse needs at least. The vertices will be given counterclockwise. Then N lines follow, each line contains an integer L followed by L pairs of integers. Each of the pair indicates a vertex of the thing¡¯s convex polygon. The vertices will be given counterclockwise. Technical Specification 1. 1 <= T <= 1000 2. 0 <= N <= 20 3. 3 <= M <= 20 4. 3 <= L <= 20 and all the things are inside the desk. 5. All the coordinates will be greater than or equal to 0 and less than or equal to 10000. Output For each test case, output the case number first, then the words ¡°Yeah, there is enough space!¡± if there is enough space on the desk to use the mouse or ¡°Oh, I have to clean my desk!¡±, otherwise. Sample Input
Sample Output
Hint or the third sample, he can put the mouse in the middle of the desk to reach everywhere within the unit square. See figure below. Author Dumbear@WHU Source | ||||||||||
|