#1425. Easy problem II
Easy problem II
For a given sequence of intergers .
There are two types of operations:
— for each , if , change , else change .
— output ans = .
Input
The input consists of multiple test cases. The first line contains a single integer () — the number of test cases.
The first line of each test case contains two integers and , (, ) — the length of sequence and the number of operations.
The next line contains integer ()
The next line contains some integers , , , (, , ) — indicating the operations.
Output
For each query, output an interger in a single line indicating the ans.
Example
1
5 5
1 2 3 4 5
1 1 5 3
2 1 2
2 2 4
1 2 3 5
2 1 5
3
14
32
Limitation
Time limit: 8 second
Memory limit: 512 megabytes