LCC/Moose '19 Contest 2 J4 - Missing Missiles


Submit solution

Points: 5 (partial)
Time limit: 2.0s
Memory limit: 64M

Author:
Problem types

After realizing that DMOJistan has the answers to next month's LCC questions, the army of the Incorporated States of MCPT has launched \(N\) missiles at DMOJistan at random locations all in a \(200\) by \(200\) grid centered at \((0, 0)\) in the hopes that the solution would be destroyed.

Unfortunately, none of them hit anything, and even worse, the head of the DMOJistan army sent back a taunting message detailing where each missile hit in relation to the solutions to the LCC problems represented as follows:

  • U meaning that missile had a higher \(y\) coordinate than the LCC solutions.
  • D meaning that missile had a lower \(y\) coordinate than the LCC solutions.
  • L meaning that missile had a lower \(x\) coordinate than the LCC solutions.
  • R meaning that missile had a higher \(x\) coordinate than the LCC solutions.

The MCPT army only has one missile left, so this one can't miss. They decide to ask you the following:

What is the most probable location of the LCC solutions?

Input Specification

The first line will contain an integer \(N (4 \le N \le 10^5)\), the number of missiles fired.

The next \(N\) lines will contain a single character, the location of the missile in relation to the problem solutions.

It is guaranteed that there will be at least 1 missile on each side of the problem solutions.

Output Specification

Two lines, the first one containing the \(x\) coordinate of the object, the second line containing the \(y\) coordinate of the object. Your answer will be considered correct if it has an absolute or relative error of at most \(10^{−3}\).

Sample Input 1

4
U
D
L
R

Sample Output 1

0
0

Sample Input 2

7
U
D
L
R
U
R
U

Sample Output 2

-33.333
-50

Comments

There are no comments at the moment.