After wrapping a present for her friend's birthday, Elaine discovered that she has a long length of ribbon left over. The ribbon is currently unwound, so she decided that she will fold the ribbon
The ribbon initially has a length of
The thickness of the ribbon is defined as the maximum thickness of any given point. The length of the ribbon is defined as the number of points with non-zero thickness. Given the sequence of
Input Specification
The input will contain 10 datasets. Each dataset begins with two integers
The next L
or R
, representing a fold at point
For the first 3 cases, each fold will be of type L
.
For the first 6 cases,
Output Specification
For each dataset, output two space-separated integers: the length and thickness of the ribbon.
Sample Input (Two Datasets Shown)
6 1
3 L
10 2
10 L
10 R
Sample Output
4 2
8 3
Explanation of Sample Datasets
In the first dataset, the thickness of the ribbon at each point is
In the second dataset, the thickness of the ribbon at each point is
Educational Computing Organization of Ontario - statements, test data and other materials can be found at ecoocs.org
Comments