Interval Product#6603

Interval Product

2 secondi
64 megabyte
Media

It's normal to feel worried and tense the day before a programming contest. To relax, you decided to spend some time with friends and play a small game to keep your mind sharp. To start, your friends will give you a sequence of integers X_1, X_2, \ldots, X_N. Then, there will be rounds; at each round, your friends will issue a command, which can be:

Originally, there was a penalty for a wrong answer, but you are focused on keeping your mind alert for your upcoming contest. Fortunately, your friends let you use your notebook during the game. Since you trust your coding skills more than your math, you decided to write a program to help you in the game.

Input

Each test case is described using several lines. The first line contains two integers and , indicating respectively the number of elements in the sequence and the number of rounds of the game (1 \leq N, K \leq 10^5). The second line contains integers X_i that represent the initial values of the sequence (-100 \leq X_i \leq 100 for i = 1, 2, \ldots, N). Each of the next lines describes a command and starts with an uppercase letter that is either C or P. If the letter is C, the line describes a change command, and the letter is followed by two integers and indicating that X_I must receive the value (1 \leq I \leq N and -100 \leq V \leq 100). If the letter is P, the line describes a product command, and the letter is followed by two integers and indicating that the product from X_I to X_J, inclusive, must be calculated (1 \leq I \leq J \leq N). Within each test case there is at least one product command.

Output

For each test case, output a line with a string representing the result of all the product commands in the test case. The -th character of the string represents the result of the -th product command. If the result of the command is positive, the character must be + (plus); if the result is negative, the character must be - (minus); if the result is zero, the character must be 0 (zero).

Esempi

Esempio 1

Loading
Loading