#C6472. Taco Task Queries

    ID: 50236 Type: Default 1000ms 256MiB

Taco Task Queries

Taco Task Queries

You are given n tasks, each with an initial completion time, and m queries to process. There are two types of queries:

  • Type 1: Update the completion time of a task. The query is given as: 1 k x, which means update the k-th task's time to x (1-indexed).
  • Type 2: Report the current maximum completion time among all tasks. The query is given as: 2.

For example, if you start with tasks having times [3, 8, 4, 5, 6] and process the queries: 2, 1 3 10, 2, 1 2 7, 2, then the outputs for the type 2 queries would be [8, 10, 10].

Note that the tasks are 1-indexed. Use appropriate data structures to update and query the maximum efficiently.

inputFormat

The first line contains two integers n and m where n is the number of tasks and m is the number of queries.

The second line contains n space-separated integers representing the initial completion times for each task.

The next m lines each contain a query. A query is either in the form 2 (for a maximum query) or 1 k x (for updating the k-th task time to x).

outputFormat

For each query of type 2, output the current maximum completion time on a new line.

## sample
5 5
3 8 4 5 6
2
1 3 10
2
1 2 7
2
8

10 10

</p>