#P17575. [JAG 2026 Summer Camp #3] Self-Destruct Sequence
[JAG 2026 Summer Camp #3] Self-Destruct Sequence
Problem Description
You are given a sequence of positive integers .
For each (), solve the following problem:
Let initially be the sequence . At any point during the process, let denote the current length of and let denote its -th element.
You may perform the following operation any number of times.
- Choose an index () satisfying . Remove the elements from . The remaining elements, in their original order, form the new sequence .
Determine whether can be made empty. If so, find the minimum and maximum possible numbers of operations required.
Input Format
The input consists of a single test case of the following format.
N
A_1 A_2 ... A_N
The first line contains an integer (), representing the length of the sequence.
The second line contains integers ().
Output Format
Print lines.
For each (), the -th line should contain the answer for . If it is impossible to make empty, print -1. Otherwise, print two integers: the minimum and maximum possible numbers of operations required to make empty, respectively.
5
3 4 2 1 1
-1
-1
1 1
2 2
2 3
6
2 1 3 2 1 2
-1
1 1
2 2
-1
2 3
3 4