[UOI 2025] Simple Subsequence
该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。
题目描述
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.
输入格式
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 .
输出格式
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
提示
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.