← November 2025 questions

NOVEMBER 2025 / ADVANCED / QUESTION 6

Question 6

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.

At WonderLand Theme Park, there is a long row of N magic stalls (2 ≤ N ≤ 248), each
with a power level between 1 and 40.
A magic stall can be upgraded using the following rule:
Upgrade Move: If two adjacent stalls both have the same power, you may merge them
into one stall with power (power + 1).
Example: Two stalls with power 7 side-by-side can merge into a single stall with power
8. After merging, the number of stalls decreases by 1.
Goal: Your goal is to maximize the highest stall power in the entire row after performing
as many merges as you want. You may merge in any order.
Input Format:
• First line: N , the number of stalls
• Next N lines: the initial power of each stall
Output Format: Print one integer: The maximum stall power you can obtain by
merging wisely.
Sample Input:
4
1
1
1
2
Sample Output:
3
Question Input File:
• Input: https://shorturl.at/HrFU0

PRACTICE CHECK

Try your answer.

The linked final-input download could not be retrieved (checked 28 October 2026). This checks the complete published sample, not the unavailable final input.

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.

Use the published sample: N=4 and powers [1,1,1,2]. Enter the maximum obtainable power.

Reveal worked answer

Your output

3

Merge the second and third 1 into 2, then merge that 2 with the last 2 to create power 3. Interval dynamic programming handles general inputs.

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.