A7955 | Hide-and-Seek
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
Victor and Peter are playing hide-and-seek. Peter has hidden, and Victor is to find him. In the room where they are playing, there is only one non-transparent wall and one double-sided mirror. Victor and Peter are points with coordinates $(x_{v},y_{v})$ and $(x_{p},y_{p})$ respectively. The wall is a segment joining points with coordinates $(x_{w,1},y_{w,1})$ and $(x_{w,2},y_{w,2})$ , the mirror — a segment joining points $(x_{m,1},y_{m,1})$ and $(x_{m,2},y_{m,2})$ .
If an obstacle has a common point with a line of vision, it's considered, that the boys can't see each other with this line of vision. If the mirror has a common point with the line of vision, it's considered, that the boys can see each other in the mirror, i.e. reflection takes place. The reflection process is governed by laws of physics — the angle of incidence is equal to the angle of reflection. The incident ray is in the same half-plane as the reflected ray, relative to the mirror. I.e. to see each other Victor and Peter should be to the same side of the line, containing the mirror (see example 1). If the line of vision is parallel to the mirror, reflection doesn't take place, and the mirror isn't regarded as an obstacle (see example 4).
Victor got interested if he can see Peter, while standing at the same spot. Help him solve this problem.
If an obstacle has a common point with a line of vision, it's considered, that the boys can't see each other with this line of vision. If the mirror has a common point with the line of vision, it's considered, that the boys can see each other in the mirror, i.e. reflection takes place. The reflection process is governed by laws of physics — the angle of incidence is equal to the angle of reflection. The incident ray is in the same half-plane as the reflected ray, relative to the mirror. I.e. to see each other Victor and Peter should be to the same side of the line, containing the mirror (see example 1). If the line of vision is parallel to the mirror, reflection doesn't take place, and the mirror isn't regarded as an obstacle (see example 4).
Victor got interested if he can see Peter, while standing at the same spot. Help him solve this problem.
输入格式
The first line contains two numbers $x_{v}$ and $y_{v}$ — coordinates of Victor.
The second line contains two numbers $x_{p}$ and $y_{p}$ — coordinates of Peter.
The third line contains 4 numbers $x_{w,1}$ , $y_{w,1}$ , $x_{w,2}$ , $y_{w,2}$ — coordinates of the wall.
The forth line contains 4 numbers $x_{m,1}$ , $y_{m,1}$ , $x_{m,2}$ , $y_{m,2}$ — coordinates of the mirror.
All the coordinates are integer numbers, and don't exceed $10^{4}$ in absolute value. It's guaranteed, that the segments don't have common points, Victor and Peter are not on any of the segments, coordinates of Victor and Peter aren't the same, the segments don't degenerate into points.
The second line contains two numbers $x_{p}$ and $y_{p}$ — coordinates of Peter.
The third line contains 4 numbers $x_{w,1}$ , $y_{w,1}$ , $x_{w,2}$ , $y_{w,2}$ — coordinates of the wall.
The forth line contains 4 numbers $x_{m,1}$ , $y_{m,1}$ , $x_{m,2}$ , $y_{m,2}$ — coordinates of the mirror.
All the coordinates are integer numbers, and don't exceed $10^{4}$ in absolute value. It's guaranteed, that the segments don't have common points, Victor and Peter are not on any of the segments, coordinates of Victor and Peter aren't the same, the segments don't degenerate into points.
输出格式
Output YES, if Victor can see Peter without leaving the initial spot. Otherwise output NO.
输入输出样例
输入 #1
-1 3 1 3 0 2 0 4 0 0 0 1
输出 #1
NO
输入 #2
0 0 1 1 0 1 1 0 -100 -100 -101 -101
输出 #2
NO
输入 #3
0 0 1 1 0 1 1 0 -1 1 1 3
输出 #3
YES
输入 #4
0 0 10 0 100 100 101 101 1 0 3 0
输出 #4
YES
暂无题解
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted