Canadian Computing Competition: 2019 Stage 1, Junior #4, Senior #1
You are trying to pass the time while at the optometrist. You notice there is a grid of four numbers:
You see lots of mirrors and lenses at the optometrist, and wonder how flipping the grid horizontally or vertically would change the grid.
Specifically, a "horizontal" flip (across the horizontal centre line) would take the original grid of four numbers and result in:
A "vertical" flip (across the vertical centre line) would take the original grid of four numbers and result in:
Your task is to determine the final orientation of the numbers in the grid after a sequence of horizontal and vertical flips.
Input Specification
The input consists of one line, composed of a sequence of at least one and at most characters. Each character is either H
, representing a horizontal flip, or V
, representing a vertical flip.
For 8 of the 15 available marks, there will be at most characters in the input.
Output Specification
Output the final orientation of the four numbers. Specifically, each of the two lines of output will contain two integers, separated by one space.
Sample Input 1
HV
Sample Output 1
4 3
2 1
Sample Input 2
VVHH
Sample Output 2
1 2
3 4
Comments
wow this problem is easier tha i thought
Too ez to be a S1
Easiest S1 in a while. Brute forcing the whole problem pulls through. There is a smart way involving cancelling the Vs and the Hs out. The time and memory limit is sufficient for either approach.
it is probably the easiest question in J4, S1 of CCC
i finished the problem with 0.01 seconds left lol
Brute force gives you full mark???
why is this a j4/s1?
Why is the memory limit so high?
2 verticals cancel out