#P17270. [eJOI 2026] Increasing Split
[eJOI 2026] Increasing Split
Problem Description
Boris and Ihor have found a sequence of positive integers, , and want to split it between themselves. Unable to agree on the split, they have asked you to act as their arbiter.
Before making any decisions, you are shown the entire sequence. You then process the elements of from left to right: first , then , and so on up to . As each element is processed, you must give it to exactly one of Boris and Ihor.
Both insist that the elements they receive form a strictly increasing sequence in the order received. Every element you give to a person must be strictly greater than the previous element given to that same person. The first element a person receives may have any value, and one person may receive no elements at all.
For every integer from to , determine whether it is possible to split the elements so that Boris receives exactly elements and both resulting sequences are strictly increasing. Treat every value of as an independent question.
For example, let .
- For , give , , and to Boris, and give and to Ihor. Boris receives and Ihor receives ; both sequences are strictly increasing, so is possible.
- For , Boris receives nothing and Ihor receives everything. Ihor's sequence begins with , so it is not strictly increasing and is impossible.
For this example, the only possible values of are and .
Implementation details
Implement the following function:
std::vector<bool> increasing_split(std::vector<int> a)
- : the sequence of numbers.
The function must return a boolean array of size exactly . Its element at index must be true if the elements can be split so that Boris receives exactly elements and both resulting sequences are strictly increasing, and false otherwise. The function is called exactly once per test.
Input Format
Input format:
- line : one integer ;
- line : integers .
Output Format
If the returned array does not have size , the sample grader prints WA: Returned array does not have size N+1. Otherwise, it prints a binary string of length whose character at index is 1 if is possible, and 0 otherwise.
5
3 1 4 5 5
001100
4
1 2 3 4
11111
Hint
Explanation of example 1
Here . For each :
- : no valid split exists, so the answer is
0; - : no valid split exists in which Boris receives exactly one element, so the answer is
0; - : give and to Boris, and , , and to Ihor. Both sequences are strictly increasing, so the answer is
1; - : a valid split exists as described above, so the answer is
1; - and : no valid split exists, so both answers are
0.
Explanation of example 2
Here is already strictly increasing. Regardless of how the elements are split, both people receive strictly increasing sequences. Hence every from to is possible.
Constraints
- for every
Subtasks
| Subtask | Points | Additional constraints | |
|---|---|---|---|
| 0 | - | The examples. | |
| 1 | 10 | - | |
| 2 | 5 | for every . | |
| 3 | . | ||
| 4 | 16 | is a permutation of . For every such that , the prefix is a permutation of . | |
| 5 | 21 | is a permutation of . For every such that , the prefix is a permutation of . | |
| 6 | 17 | ||
| 7 | 16 | - | |
| 8 | 10 | ||