QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 1024 MB Total points: 100 Hackable ✓

#18389. 三段刺

Statistics

Kuong 正在玩一个立方体跳跃过尖刺的游戏。

在这个游戏的所有地图中,立方体从位置 $0$ 出发,每一帧移动 $1$ 个单位距离。如果立方体到达位置 $N$,无论是否处于空中状态,都视为通关。

如果立方体当前不处于空中状态,则可以在每一帧进行跳跃。立方体跳跃后,从下一帧开始的 $3$ 帧内处于空中状态。例如,如果在第 $1$ 帧跳跃,则从第 $2$ 帧到第 $4$ 帧处于空中状态,第 $5$ 帧起不再处于空中状态。

如果立方体在不处于空中状态时与任何尖刺的位置重合,立方体就会撞上尖刺而死亡,导致通关失败。

Kuong 认为有些地图是无法通关的。请帮 Kuong 判断地图是否可以通关。

输入格式

第一行给定 Kuong 感兴趣的地图数量 $T(1 \le T \le 1\,000)$。

接下来的 $T$ 个地图按以下格式给出:

  • 第一行给定地图长度 $N$。$(1 \le N \le 10^{18})$
  • 第二行给定尖刺数量 $X$。$(1 \le X \le \min(N - 1, 1\,000))$
  • 第三行给定各尖刺的位置 $P_1, P_2, \cdots, P_X$,以空格分隔。$(1 \le P_1 < P_2 < \cdots < P_X \le N-1)$

输入的所有数均为整数。

输出格式

对于每个给定的地图,如果可以通关,输出 POSSIBLE;否则输出 IMPOSSIBLE

样例

输入 1

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

输出 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.