Requests#8766

Requests

1 second
64 megabytes
Very easy

You have an array of length . You will receive queries of two types:

  1. Update the -th element in the array to .

  2. Retrieve the -th element from the array .

Input

The first line contains two integers and (1 \leq n \leq 100, 1 \leq m \leq 1,000) — the length of the array and the number of queries.

The second line contains integers a_1, a_2, ..., a_n (1 \leq a_i \leq 100) — the elements of the array. Each of the next lines describes a query and follows one of these formats:

  1. "1 p v" (1 \leq p \leq n, 1 \leq v \leq 100) — specifies the position and the new value.

  2. "2 p" (1 \leq p \leq n) — specifies the position.

Interaction

You need to implement the following three functions:

void init(integer n, array of integers a)

  • — the length of the array.

  • — the array of integers.

  • This function is called first and only once. It provides the size of the array and the array itself. The other two functions will be called only after this function has been executed.

void upd(integer p, integer v)

  • — the position in the array.

  • — the new value to be assigned.

  • This function is called to execute a query of the first type.

integer ask(integer p)

  • — the position in the array.

  • This function is called to execute a query of the second type.

  • The function should return an integer, which is the result of the query.

Output

For each query of the second type, output one integer — the result of the query.

Examples

Example 1

Loading
Loading

Scoring

  1. (20 points) n \leq 10; m \leq 100; a_i, v_i \leq 20;

  2. (20 points) n \leq 30; m \leq 300; a_i, v_i \leq 30;

  3. (20 points) n \leq 50; m \leq 500; a_i, v_i \leq 50;

  4. (20 points) n \leq 75; m \leq 750; a_i, v_i \leq 75;

  5. (20 points) without additional constraints.