QOJ.ac

QOJ

时间限制: 1 s 内存限制: 2048 MB 总分: 100

#8071. 丝带之路

统计

Christie 是一只喜欢在闭合丝带(即一个首尾相连的多边形)上爬行的蚂蚁。她的主人 Cindy 会在丝带上放一块方糖供她享用。Cindy 总是把方糖放在丝带的外侧,因此 Christie 希望在丝带的外侧爬行,以便在丝带路上的某处找到方糖。然而,由于 Christie 非常小,她通常很难判断自己是在丝带的内侧还是外侧爬行。如果她在内侧,她就需要小心地爬到外侧去。

幸运的是,Christie 的触角可以发射信号,即一条射线。Christie 发射的射线从她所在的位置出发,射向另一点 $(x, y)$,射线可能会穿过丝带。她发射的射线覆盖了 $[0^\circ, 180^\circ]$ 的范围,其中与她当前所处线段平行的方向(指向前方)为 $0^\circ$,射线范围向上延伸,与她自身平行的方向(指向后方)为 $180^\circ$。丝带没有扭曲(即丝带不会绕自身旋转),因此它不是莫比乌斯带。所以,当 Christie 沿着丝带行走时,她是在内侧还是外侧始终保持不变。

射线可以用来判断 Christie 是在丝带的内侧还是外侧爬行。注意,如果射线恰好与她所处的线段平行,那么她将无法判断自己是在内侧还是外侧。此外,如果她站在多边形的顶点上,她也可能无法确定答案。请帮助 Christie 判断她是否在丝带路的内侧。

Christie 触角范围示意图,从中可以看到如果天线发射 $0^\circ$ 或 $180^\circ$ 的射线,Christie 将无法判断自己是在内侧还是外侧。

输入格式

第一行包含一个整数 $N$ ($3 \le N \le 10^5$),表示多边形的顶点数。接下来的 $N$ 行,每行包含一对整数 $(x_i, y_i)$,按顺序表示多边形的第 $i$ 个顶点 ($1 \le i \le N$)。丝带路是一个闭合的简单多边形,因此最后一个顶点与第一个顶点相连。任意三个连续的顶点不共线。最后一行包含四个整数 $(x_c, y_c)$ 和 $(x, y)$,分别表示 Christie 的位置以及 Christie 信号穿过的点。

Christie 始终在丝带上沿平行于丝带的方向停留,但 $(x, y)$ 的位置没有限制。如果 Christie 停留在丝带的顶点上,则她可以平行于该顶点相邻的任意一条边。保证 $(x_c, y_c) \neq (x, y)$。

所有坐标满足 $-10^6 \le x_i, y_i, x_c, y_c, x, y \le 10^6$。

输出格式

如果 Christie 在内侧,输出 inside;如果 Christie 在外侧,输出 outside;如果无法确定,输出 ?

样例

样例输入 1

4
0 0
2 0
2 2
0 2
1 0 1 1

样例输出 1

inside

样例输入 2

4
0 0
0 2
2 2
2 0
1 0 -1 0

样例输出 2

?

样例输入 3

4
0 0
5 0
5 5
0 5
4 0 1 0

样例输出 3

?

样例输入 4

4
0 0
2 0
2 2
0 2
0 0 1 1

样例输出 4

inside

样例输入 5

4
0 0
2 0
2 2
0 2
0 0 -1 -1

样例输出 5

outside

样例输入 6

4
0 0
1 0
1 1
0 1
0 0 1 -1

样例输出 6

?

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.