A15042 | Circular Maze
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
Each test contains multiple test cases. The first line contains an integer $t$ ( $1\le t\le 20$ ) — the number of test cases. The descriptions of the $t$ test cases follow.
The first line of each test case contains an integer $n$ ( $1 \leq n \leq 5000$ ) — the number of walls.
Each of the following $n$ lines each contains a character (C for circular, and S for straight) and three integers:
- either $r, \theta_1, \theta_2$ ( $1 \leq r \leq 20$ and $0 \leq \theta_1,\theta_2 < 360$ with $\theta_1 \neq \theta_2$ ) if the wall is circular,
- or $r_1$ , $r_2$ and $\theta$ ( $1 \leq r_1 < r_2 \leq 20$ and $0 \leq \theta < 360$ ) if the wall is straight.
It is guaranteed that circular walls do not overlap (but two circular walls may intersect at one or two points), and that straight walls do not overlap (but two straight walls may intersect at one point). However, circular and straight walls can intersect arbitrarily.
The first line of each test case contains an integer $n$ ( $1 \leq n \leq 5000$ ) — the number of walls.
Each of the following $n$ lines each contains a character (C for circular, and S for straight) and three integers:
- either $r, \theta_1, \theta_2$ ( $1 \leq r \leq 20$ and $0 \leq \theta_1,\theta_2 < 360$ with $\theta_1 \neq \theta_2$ ) if the wall is circular,
- or $r_1$ , $r_2$ and $\theta$ ( $1 \leq r_1 < r_2 \leq 20$ and $0 \leq \theta < 360$ ) if the wall is straight.
It is guaranteed that circular walls do not overlap (but two circular walls may intersect at one or two points), and that straight walls do not overlap (but two straight walls may intersect at one point). However, circular and straight walls can intersect arbitrarily.
输入格式
For each test case, print YES if the maze can be solved and NO otherwise.
输出格式
The two sample test cases correspond to the two mazes in the picture.
输入输出样例
输入 #1
2 5 C 1 180 90 C 5 250 230 C 10 150 140 C 20 185 180 S 1 20 180 6 C 1 180 90 C 5 250 230 C 10 150 140 C 20 185 180 S 1 20 180 S 5 10 0
输出 #1
YES NO
The two sample test cases correspond to the two mazes in the picture.
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted