Rebounds P55760


Statement
 

pdf   zip

html

In a horizontal cylindrical tunnel that is 1 centimeter in diameter there are 1-centimeter-diameter-balls that move to the right or to the left, all at 1 cm/s. Every time that two balls collide, both them change their direction. Balls also change their direction when colliding against an extreme of the tunnel. The collisions are elastic and there is not friction.

Write a program that reads several experiments, and for each one prints the position and the direction of movement of every ball during some seconds.

Input

Input consists of several experiments. The description of each experiment begins with the length of the tunnel n and the number of steps s. Follow the number of balls that move to the right and the positions where they are. Follow the number of balls that move to the left and the positions where they are. Assume n≥ 2, s≥ 1, that the distance d between two balls is always an even number, that d can only be 0 just before colliding (‘><’ in the exemple), that in the leftmost position there is never a ‘>’, and that in the rightmost position there is never a ‘<’.

Output

For each experiment, print s lines, the first one with the experiment’s initial situation, and each one of the rest with the tunnel configuration a second after. Print a ‘>’ for every ball that moves to the right, a ‘<’ for every ball that moves to the left, and a dot for every empty position. Print an empty line after the output for each experiment.

Public test cases
  • Input

    24 6
    1   15
    3   2 7 10
    
    9 5
    0
    3   1 7 4
    

    Output

    .<....<..<....>.........
    <....<..<......>........
    .>..<..<........>.......
    ..><..<..........>......
    .<..><............>.....
    <..<..>............>....
    
    <..<..<..
    .><..<...
    <..><....
    .><..>...
    <..>..>..
    
    
  • Information
    Author
    Salvador Roura
    Language
    English
    Translator
    Carlos Molina
    Original language
    Catalan
    Other languages
    Catalan
    Official solutions
    C++
    User solutions
    C++