A common operation in graphical environments is the handling of overlapping windows. Only the exposed portions of a window are displayed, with special routines written to determine what portions of a window are exposed, and should be dealt with. Your task is to take a list of windows, do the appropriate manipulations, and, upon request, indicate the exposed area of a given window.
The program reads the input file INPUT.TXT as a series of one instruction per line in the following format:
In the above input 'w', 't', 'b', 'e', 's' are the commands manipulating the windows. The rest of the information represent the following data:
The output file of the program OUTPUT.TXT will simply be responses to the 's' commands. For each 's' command found and processed in the input file, one output line is generated that shows in a percentage the exposed area of the indicated window.
The screen that all windows will be displayed on will not exceed 250x250. The thickness of windows boundaries is negligible (i.e. w(a,0,4,4,0) is a window of area 16).
Correct output values will be considered those with ñ0.02% deviation from the indicate value in the output (i.e. for 29.83% the percentages 29.81%, 29.82%, 29.84% and 29.85% will be consider correct).
Time limit per test : 5 seconds
Maximum Score : 30