next up previous
Next: Formatting HTML Text Up: No Title Previous: Finger-Friendly Domain Names

Web Browser Window Placement

You are the chief programmer for easyBrowse Inc. -- the company that will revolutionize the world by creating a better faster easier web browser. Now all the new-fangled web pages keep popping up more and more windows each time you visit their web-site: your job today is to find the best place on the screen to place these new windows so that they cause your customers the least pain. After talking to the marketing people, the psychology people, the human-computer interaction people, the advertising people, and the marketing people again, you have come up with the following rules for placement of windows for easy browsing (tm):

Input Format

The input to your program is a list of window sizes:

10 10
320 20
319 230
319 230
120 23
-1  -1

The first number on a line is the width of the window, while the second number is the height of the window. Note that you can be multiple given windows of a given size and you don't a-priori know the maximum number of windows you may have to place. A -1 -1 entry signifies end of input.

Output Format

The output of your program is the placement of the windows using the following format:

New window of size  10 x  10: Final placement: [(  0   0), (  9   9)]
New window of size 320 x  20: Final placement: [(  0  10), (319  29)]
New window of size 319 x 230: Final placement: [(  0  10), (318 239)]
New window of size 319 x 230: Final placement: [(  1   0), (319 229)]
New window of size 120 x  23: Final placement: [(200 217), (319 239)]

Note that you are required to print the exact pixels that the top-left and bottom-right corners of each window occupy. Further, the top-left pixel is coordinate (0,0) and the bottom right pixel is coordinate (319, 239).

Example

Lets walk through what happens when we try to place the set of windows given the previous section:

More examples

table211

Test data used in judging

Input 1 Output 1
Input 2 Output 2
Input 3 Output 3

Our Solution


next up previous
Next: Formatting HTML Text Up: No Title Previous: Finger-Friendly Domain Names

Chau-Wen Tseng
Tue Mar 14 18:48:15 EST 2000