#SRD0000083. Học máy và tần suất (Machine Learning)
Bài tập thuộc lộ trình
Mục lục đề ⌄
Học máy và tần suất (Machine Learning)
Machine Learning
Source: Codeforces
Version: Phuoc Hung OJ Extended
Problem Statement
You are given a sequence of positive integers . Process two types of operations in their original order. Query 1 l r: for each nonnegative integer value , let denote its frequency in . Output the minimum excluded nonnegative integer (MEX) of the set . Query 2 p x: assign . All array elements are positive, hence and the required MEX is positive. Each query uses the array after all preceding updates.
Input
The first line contains . The second line contains integers . Each of the next lines contains exactly three integers in one of the forms 1 l r or 2 p x. Indices are 1-based and query ranges are inclusive.
Output
For every type-1 operation, output the required MEX on its own line. Type-2 operations produce no output.
Subtasks
-
Subtask 1 (10 points): ; . ; ; .
-
Subtask 2 (20 points): ; . ; ; .
-
Subtask 3 (30 points): ; . ; ; .
-
Subtask 4 (40 points): ; . ; ; .
Examples
Input
10 4
1 2 3 1 1 2 2 2 9 9
1 1 1
1 2 8
2 7 1
1 2 8
Output
2
3
2
Explanation
For the first query the only positive frequency is 1, so the MEX is 2. Before the update, positive frequencies in are 1, 2 and 4, yielding MEX 3. After assigning , the positive frequencies become 1 and 3, yielding MEX 2.