Akku have solved many problems, she is genius. One day her friend gave her an Array and asked her to perform

some queries of following type:

Each query consists of three integers

1 A B : Update the Array at index A by value B

2 A B : if the subarray from index A to B (both inclusive) is

1. Both increasing(Non-decreasing) and decreasing(Non-increasing) print -1

2. Only increasing(Non-decreasing) print 0

3. Only decreasing(Non-increasing) print 1

4. Neither increasing nor decreasing print -1

Akku needs your help, can you help her.

**Input:**

The first line of input constists of the integer T, indicating the number of test cases.The first line of each

test case constists of the number N, indicating the number of elements in the array,A. Next line consists of N space

seperated integers indicating the array. Next line consists of an integer Q , denoting the

number of queries. Next Q lines consists of three integers X,A,B

**Output:**

For each test case query of type 2, the output is an integer indicating the required Answer in newline.

**Constraints:**

1 <= T <= 5

1 <= N <= 100000

1 <= A[i] <= 100000

1 <= Q <= 100000

**Example:
Input:**

1

7

1 5 7 4 3 5 2

5

2 1 3

2 2 4

2 3 4

1 6 3

2 5 6

0

-1

1

-1

If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.

ShubhamJain18 | 205 |

makeitdonesolo | 140 |

lost_found | 124 |

maggiiiii | 118 |

SahatPrasad1 | 108 |

Bishnu Dev Panda | 777 |

okayboss | 551 |

ShubhamJain18 | 516 |

yk12 | 514 |

makeitdonesolo | 480 |

blackshadows | 5331 |

Ibrahim Nash | 5219 |

akhayrutdinov | 5111 |

mb1973 | 4925 |

Quandray | 4547 |

Login to report an issue on this page.