#C8332. Platform Jumping Possibility

    ID: 52303 Type: Default 1000ms 256MiB

Platform Jumping Possibility

Platform Jumping Possibility

In this problem, you are given (n) platforms, each with an associated height. Although the heights are provided, they do not affect the jumping logic. From a given starting platform (i), you can move only to adjacent platforms (i.e., (i+1) or (i-1)). Your task is to determine whether it is possible to reach the destination platform (j) in exactly (k) jumps. The minimum required jumps are (|j - i|), and to use exactly (k) jumps, the difference (k - |j - i|) must be even. Print (\text{POSSIBLE}) if the journey can be completed in exactly (k) jumps, or (\text{IMPOSSIBLE}) otherwise.

inputFormat

The input is given via standard input. The first line contains an integer (n) ((1 \le n \le 10^5)) representing the number of platforms. The second line contains (n) space-separated integers denoting the heights of the platforms (these values are not used in jump calculations). The third line contains an integer (q) ((1 \le q \le 10^5)) representing the number of queries. Each of the following (q) lines contains three integers (i), (j), and (k) (with (1 \le i, j \le n) and (0 \le k \le 10^9)), where (i) is the starting platform, (j) is the destination platform, and (k) is the exact number of jumps required.

outputFormat

For each query, output a single line containing (\text{POSSIBLE}) if you can reach platform (j) from platform (i) in exactly (k) jumps, or (\text{IMPOSSIBLE}) if not.## sample

5
2 3 1 5 4
3
1 3 2
2 5 4
1 4 1
POSSIBLE

IMPOSSIBLE IMPOSSIBLE

</p>