CF1662O.Circular Maze

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Each test contains multiple test cases. The first line contains an integer tt ( 1t201\le t\le 20 ) — the number of test cases. The descriptions of the tt test cases follow.

The first line of each test case contains an integer nn ( 1n50001 \leq n \leq 5000 ) — the number of walls.

Each of the following nn lines each contains a character (C for circular, and S for straight) and three integers:

  • either r,θ1,θ2r, \theta_1, \theta_2 ( 1r201 \leq r \leq 20 and 0θ1,θ2<3600 \leq \theta_1,\theta_2 < 360 with θ1θ2\theta_1 \neq \theta_2 ) if the wall is circular,
  • or r1r_1 , r2r_2 and θ\theta ( 1r1<r2201 \leq r_1 < r_2 \leq 20 and 0θ<3600 \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.

首页