#P12547. [UOI 2025] Simple Subsequence
[UOI 2025] Simple Subsequence
Description
We call an array of integers good if its length is equal to , or for any , both values and are non-negative. Here, denotes .
We define the beauty of the array as the length of its longest good subsequence.
You are given an array of length , which consists of numbers and .
You need to perform queries. The queries are of two types:
- replace the element with , where --- the parameter of the query;
- find the beauty of the array consisting of elements , where --- the parameters of the query.
Input Format
In the first line, two integers , are given --- the length of the array and the number of queries, respectively.
In the second line, integers are given --- the elements of the array .
In the next lines, the description of the queries is given. The first of the numbers denotes the type of the query. Queries of the first type are given in the format , and queries of the second type are given in the format .
Output Format
For each query of the second type, output one integer in a separate line --- the beauty of the corresponding array.
5 4
1 1 1 -1 1
2 1 5
1 3
2 1 4
2 2 5
5
2
3
4 4
1 1 1 -1
2 1 2
2 2 4
2 3 3
2 3 4
2
2
1
1
Hint
An array is called a subsequence of an array if it is possible to remove a certain number of elements from the array (possibly zero) so that the array is formed. The empty array is a subsequence of any array.
Scoring
- ( points): for , and there are no type one queries;
- ( points): , and there are no type one queries;
- ( points): ;
- ( points): ;
- ( points): , and there are no type one queries;
- ( points): ;
- ( points): no additional restrictions.
京公网安备 11011102002149号