Snakes! P53951


Statement
 

pdf   zip

thehtml

Write a program that reads a sequence of snakes, and prints them one after another.

Input

Input consists of a sequence of snake definitions, each one in a line. Each definitions starts with two natural numbers: c is the column where starts the snake; n is the number of times that changes of sense (from right to left or from left to right). After n numbers come p1, …, pn indicating in which rows changes of sense. Finally, a natural r comes indicating the row where has the eyes.

The rows and the columns start in 1. Assume that 0 < p1 < … < pn < r, and that the snake never goes out of the left side. Each snake starts moving to the right.

Output

Print the snakes as it is shown in the instance, separating them with a space.

Public test cases
  • Input

    1 1 3 4
    3 2 4 6 9
    

    Output

    \  \
     \  \
     /  /
    (o o)
     \_/
      |
      ^
    
      \  \
       \  \
        \  \
        /  /
       /  /
       \  \
        \  \
         \  \
         (o o)
          \_/
           |
           ^
    
  • Information
    Author
    Salvador Roura
    Language
    English
    Translator
    Carlos Molina
    Original language
    Catalan
    Other languages
    Catalan
    Official solutions
    C++
    User solutions
    C++