编程介的小学生 2017-03-21 09:16 采纳率: 20.5%
浏览 709
已采纳

A Less Simple Task in Windows

As Roy has described in his simple problem of SunnyCup 2005, a typical windows platform may have several windows on the desktop. A user's operation may be as simple as a single click of the mouse. In the implementation of such a windows platform, one of the simplest tasks would be deciding which window has been clicked.

Your task is still that given a set of windows, for each mouse click, decide which window has been clicked. Please notice that windows may overlap, and the window on top would receive the click rather than others. This problem is less simple because a window WILL be activated to the top by a click. And more, two consecutive clicks at the same point on the title area of a window are considered as a double-click and will maximize the window, and a double-click on the title area of a maximized window will restore its original shape. A window or its title area is considered being clicked even if the mouse is just on its edge or corner.

Input
The input consists of several test cases.

For each case, 4 positive integers are given in the first line: N (<= 5) -- the number of windows, H -- the height of the title area, Wmax and Hmax -- the width and height of a maximized window, respectively. Then N lines follow, each containing four integers, x1, y1, x2, y2, (x1<x2, y2<y1, H<(y1-y2)) the coordinates of the upper-left and lower-right corners of a window. The origin is at the lower-left corner of the screen. The windows are given in back-to-front order.

After the initial positions of windows, a positive integer M (<= 30) is given, indicating the number of mouse clicks. Then M lines follow, each containing two integers, x and y, the coordinates of a mouse click.

Output
For each test case, print in a line the indices (starting from 0) of the windows which receive clicks in the input. If there is no such window, output "-1" instead. The indices must be separated by a space and there must be no extra space at the end of a line.

Sample Input:
5 20 1280 1024
50 100 100 50
100 100 150 50
100 150 150 100
50 150 100 100
75 125 125 75
9
1 1
55 91
85 80
101 130
101 130
99 101
1280 1004
1280 1004
99 101
1 20 1280 1024
50 150 150 50
2
100 135
1000 1000
Sample Output:
-1 0 0 2 2 2 2 2 4
0 -1

  • 写回答

2条回答 默认 最新

  • threenewbee 2017-03-21 11:37
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog
  • ¥15 Excel发现不可读取的内容