#C3705. Farthest from Start
Farthest from Start
Farthest from Start
Two players, Laura and Mark, start at position 0 on a number line. They perform N moves. Laura follows the moves in the given order, while Mark performs the moves in reverse order. The final position of a player is computed as the sum of the moves.
Formally, if the moves are given by \(a_1, a_2, \dots, a_N\), then:
\(L = \sum_{i=1}^{N} a_i, \quad M = \sum_{i=1}^{N} a_{N-i+1}\),
where \(L\) is Laura's final position and \(M\) is Mark's final position. The task is to determine which player ends up farther from the starting point (i.e. has a larger absolute displacement). Output LAURA
if \(|L| > |M|\), MARK
if \(|L| < |M|\), and EQUAL
if \(|L| = |M|\).
Note: Since addition is commutative, reversing the order of moves does not change the sum. Hence, for any test case the answer will always be EQUAL
. This problem is designed as a trick question.
inputFormat
The first line of input contains a single integer \(T\) representing the number of test cases. For each test case, the first line contains an integer \(N\) denoting the number of moves. The second line contains \(N\) space-separated integers representing the moves along the number line.
outputFormat
For each test case, output one line containing LAURA
if Laura's absolute displacement is greater than Mark's, MARK
if it is smaller, or EQUAL
if both are the same.
3
5
1 -2 3 -1 2
4
2 -1 -1 2
6
3 -3 2 -2 1 -1
EQUAL
EQUAL
EQUAL
</p>