CCSC Mid-South Programming Contest

Start

2018-04-06 10:00 AKDT

CCSC Mid-South Programming Contest

End

2018-04-06 14:00 AKDT
The end is near!
Contest is over.
Not yet started.
Contest is starting in -901 days 3:25:03

Time elapsed

4:00:00

Time remaining

0:00:00

Problem C
Mountain Range

/problems/ccsc18.mountainrange/file/statement/en/img-0001.jpg
Photo of Mount Everest by shrimpo1967. CC BY-SA 2.0.

Good news: you have been hired to do all the special effects for a film! One of the scenes will take place outside, on a windswept plain with a towering mountain range in the background. Your job is to turn a description of the mountain range into a rendered image.

The bad news: the film’s producers have an extremely small budget, and so they can’t afford luxuries like rendered 3D graphics made up of pixels. Hence, you will be making your image out of ASCII characters.

Input

Input begins with a number $m$ on a single line, denoting the number of mountains in the mountain range, with $1 \leq m \leq 100$.

$m$ lines follow, each describing one mountain. A mountain description is composed of five space-separated integers $x$, $h$, $z$, $t$, and $s$.

  • $x$ is the $x$-coordinate of the mountain’s peak, with $1 \leq x \leq 199$.

  • $h$ is the height of the mountain, with $1 \leq h \leq 100$.

  • $z$ indicates the relative distance of the mountain from the viewer, with $1 \leq z \leq m$. The smaller the value of $z$, the closer the mountain is to the viewer. Closer mountains hide ones that are farther away.

  • $t$ is the height of the treeline. The side of the mountain up to the treeline should be filled with trees, represented by the ASCII character Y.

  • $s$ is the height of the snowline. The side of the mountain above the snowline should be filled with snow, represented by the ASCII character *.

You may assume $0 \leq t \leq s \leq h$. You may also assume $0 \leq x - h$ and $x + h \leq 200$ for each mountain, which means that the base of a mountain will never extend into negative $x$ coordinates, or beyond $200$ units from the left margin. Hence all mountains will fit within a $100 \times 200$ grid. All $z$-values will be unique.

Output

The output should consist of an ASCII drawing of the specified mountain range. Each mountain is triangular in shape with its sides drawn using / and \ characters. For example, here is a mountain of height $4$:

   /\
  /  \
 /    \
/      \

This mountain has $x$-coordinate $4$, since the horizontal distance from the left margin to its peak is $4$ units.

Trees and snow should fill the interior of the mountain but not obscure the sides of the mountain. For example, here is a mountain with height $6$, treeline height $2$, and snowline height $3$:

     /\
    /**\
   /****\
  /      \
 /YYYYYYYY\
/YYYYYYYYYY\

That is, the trees extend from the base of the mountain up to a height of $2$ units, and the snow starts at a height of $3$ units and extends to the top of the mountain.

Mountains with a smaller $z$-coordinate may hide all or part of a mountain with a larger $z$-coordinate; see the third sample input/output below.

Whitespace is important. For example, note the leading whitespace in Sample Output 1 below. There should never be any spaces at the end of a line of output.

Sample Input 1 Sample Output 1
1
8 5 1 2 3
       /\
      /**\
     /    \
    /YYYYYY\
   /YYYYYYYY\
Sample Input 2 Sample Output 2
1
2 2 1 0 1
 /\
/  \
Sample Input 3 Sample Output 3
4
8 5 2 2 3
2 2 1 0 1
9 8 3 1 4
17 4 4 4 4
        /\
       /**\
      /****\
     /*/\***\
    / /**\   \  /\
   / /    \   \/YY\
 /\ /YYYYYY\   \YYY\
/  \YYYYYYYY\YYY\YYY\