#K5746. Candy Container Operations

    ID: 30425 Type: Default 1000ms 256MiB

Candy Container Operations

Candy Container Operations

You are given n containers, each holding a candy of a certain type. You need to perform q operations on these containers. There are two types of operations:

  • 1 k x: Update the candy in the k-th container to type x.
  • 2: Query the maximum count of any candy type across all containers. In other words, output \(\max_{t} f(t)\), where \(f(t)\) is the number of candies of type \(t\).

The first line of input contains two integers \(n\) and \(q\), representing the number of containers and the number of operations.

The second line contains \(n\) integers representing the initial candy types in each container.

Each of the next \(q\) lines contains an operation in one of the two formats described above.

For every query operation (type 2), you should output the answer on a new line.

inputFormat

The input is given from stdin in the following format:

n q
c1 c2 ... cn
op1
op2
...
opq

Here:

  • \(n\) is the number of containers.
  • \(q\) is the number of operations.
  • The next line contains \(n\) integers representing the initial candy types in the containers.
  • Each of the following \(q\) lines represents an operation. An operation is either of the format 1 k x (update the candy at container k to type x) or 2 (query the maximum duplicate count).

outputFormat

For each query operation (denoted by 2), output a single integer in a new line representing the maximum number of candies of the same type currently present in any container group.

## sample
5 5
1 2 2 3 1
2
1 2 3
2
1 5 3
2
2

2 3

</p>