#SGM0000005. Dấu của tích trên đoạn (Interval Product)
Dấu của tích trên đoạn (Interval Product)
Interval Product
Source: UVa
Version: Phuoc Hung OJ Extended
Problem Statement
Given a sequence , process commands. C I V changes to . P I J asks whether is positive, negative, or zero.
Input
- The first line contains and .
- The second line contains integers with .
- Each of the next lines is
C I VorP I J. ForC, and . ForP, . At least onePcommand is present.
Output
Print one line whose characters correspond to the P commands: + for a positive product, - for a negative product, and 0 for a zero product.
Subtasks
- Subtask 1 — 20%: .
- Subtask 2 — 30%: .
- Subtask 3 — 50%: .
Examples
Input
4 6
-2 6 0 -1
C 1 10
P 1 4
C 3 7
P 2 2
C 4 -5
P 1 4
Output
0+-
Explanation
After C 1 10, range still contains the zero at position , so the first character is 0. After C 3 7, P 2 2 examines only , giving +. Finally , so is negative and gives -.