QOJ.ac

QOJ

Limite de temps : 2 s Limite de mémoire : 1024 MB Points totaux : 100 Hackable ✓

#18389. 3-Stage Thorn

Statistiques

Kuong is playing a game where a cube jumps over spikes.

In every map of this game, the cube starts at position $0$ and moves by $1$ unit every frame. If the cube reaches position $N$, the map is cleared, regardless of whether it is in the air or not.

The cube can jump at any frame if it is not currently in the air. When the cube jumps, it remains in the air for $3$ frames starting from the frame immediately following the jump. For example, if the cube jumps at frame $1$, it remains in the air from frame $2$ to frame $4$, and is no longer in the air at frame $5$.

If the cube's position coincides with a spike while it is not in the air, the cube hits the spike, dies, and fails to clear the map.

Kuong thinks that some maps are impossible to clear. Help Kuong determine the clearability of the maps.

Input

The first line contains the number of maps $T$ ($1 \le T \le 1\,000$).

Each of the $T$ maps is given in the following format:

  • The first line contains the length of the map $N$ ($1 \le N \le 10^{18}$).
  • The second line contains the number of spikes $X$ ($1 \le X \le \min(N - 1, 1\,000)$).
  • The third line contains the positions of each spike $P_1, P_2, \cdots, P_X$ separated by spaces ($1 \le P_1 < P_2 < \cdots < P_X \le N-1$).

All input numbers are integers.

Output

For each map, output POSSIBLE if it can be cleared, and IMPOSSIBLE otherwise.

Examples

Input 1

3
4
3
1 2 3
5
2
1 4
10
4
5 6 7 9

Output 1

POSSIBLE
IMPOSSIBLE
POSSIBLE

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.