← November 2025 questions

NOVEMBER 2025 / INTERMEDIATE / QUESTION 8

Farthest Robot Finder

Archived question

Try the question in your own editor, then check your output below.

THE QUESTION

Text from the official booklet. Refer to the PDF for original mathematical notation, formatting, and linked input files. Printed samples and inputs are reproduced as published.

Each robot follows movement commands (U, D, L, R) from (0,0). Calculate which
robot travels the farthest and print its ID and distance. If tied, choose the smaller
ID.
Sample Input:
4
UURDDL
UUUU
LRLRLRLR
URRDDD
Sample Output:
4 5
Question Input:
32
UURDDL
UUUUUUUUU
LRLRLRLRLRLRLRLR
URRRDDD
DDDDDDDDDDRRRRRRRRRRUUUUUUUUUULLLLLLLLLL
UUUUUUUUUUUURRRRRRRRRRDDDDDDDDDDDLLLLLLLL
RRRRRRRRRRRRR
LLLLLLLLLLLLL
UUUUUDDDDD
RRRRUUUULLLLDDDD
UUDDLRLRLRLRLRLRLRL
RRRRRRRRRRDDDDDDDDDDLLLLLLLLLL
UUUUDDDDLLLLRRRR
UUUUUUUUUURRRRRRRRRRDDDDDDDDDDDLLLLLLLLLLL
RURURURURURURURURURURU
LLLLLRRRRR
UUUUDDDDRRRRLLLL
UDUDUDUDUDUDUDUDUD
RRRRRRRRRRRRRRRRRRRR
UUUUUUUUUUUUUUU
DDDDDDDDDDDDDDDDD
LLLLLLLLLLLLLLLLLLL
UUUURRRRDDDDLLLL
UURRDDL
RRRRRRRRRRRUUUUUUUUUUULLLLLLLLLLLDDDDDDDDDD
UURRRRDDDDLLLL
UUUDDDLRLRLRLRL
LLLLLLLLLRRRRRRRR
UURRDDL
RRRLLLUUUUDDD
UUUUDDDDLLLLRRRR
RURURURURURURURURURURURURURUR

PRACTICE CHECK

Try your answer.

The printed sample conflicts with standard distance definitions. This check explicitly uses final Manhattan distance for all 32 final-input robots.

Run your program in your own editor, then paste its output below. This checks the stated output or checkpoint; it does not assess your full program. Practice attempts do not affect competition scores.

For this check, distance means final Manhattan distance from (0,0): |x|+|y|. IDs start at 1. Enter ID and distance.

Reveal worked answer

Your output

[32, 29]

Compute final horizontal and vertical displacements for each robot, then maximise their absolute-value sum; choose the first ID on ties.

Source: Girls in Code SEA 2025 Fall Competition, 29 November 2025. Booklet created by Emily Xu and the GIC question authors. Shared for non-commercial educational use with attribution, as permitted in the booklet.