Hotter Colder

Time limit1sMemory limit128 MB

Summary
After each move with a Hotter, Colder, or Same hint, compute the total area where the hidden object can still lie inside a 10 by 10 square.
Level

Hard8 of 10

Topics
Geometry, Brute force, Math, Implementation
Solved
No attempts yet

Problem

The children's game Hotter Colder is played as follows. While player A is out of the room, player B hides an object somewhere in the room. Player A then re-enters at position (0,0)(0,0) and visits various other positions around the room. Each time player A moves to a new position, player B announces "Hotter" if that position is closer to the object than the previous one, "Colder" if it is farther, and "Same" if the distance is unchanged.

Input

Input consists of up to 50 lines, each containing an x, y coordinate pair followed by one of "Hotter", "Colder", or "Same". Each pair is a position within the room, which may be assumed to be a square whose opposite corners are (0,0)(0,0) and (10,10)(10,10).

Output

For each line of input, print on its own line the total area of the region in which the object may lie, to two decimal places. If no such region exists, print 0.00.

Examples3

  1. Example 1

    Input
    10.0 10.0 Colder
    10.0 0.0 Hotter
    0.0 0.0 Colder
    10.0 10.0 Hotter
    
    Expected output
    50.00
    37.50
    12.50
    0.00
    
  2. Example 2

    Input
    5.0 5.0 Same
    
    Expected output
    0.00
    
  3. Example 3

    Input
    5.0 5.0 Hotter
    
    Expected output
    87.50