#P17383. [PacNW 2025] Fractal Painting
[PacNW 2025] Fractal Painting
Problem Description
A fractal painting consists of infinitely many line segments. The first segment, called A, connects to . Segments B and C connect to and , respectively.
The rest of the painting is defined recursively. From , draw segments D and E so that the three-segment figure B-D-E is similar to A-B-C. Here, similar means that one figure can be matched point-for-point to the other by translation, rotation, and scaling. Likewise, draw segments F and G from so that C-F-G is similar to A-B-C. Continue this process forever.
Determine whether some rectangle of finite size can contain the entire fractal painting.
Input Format
The first line contains an integer (), the number of test cases.
Each test case contains six integers . Every coordinate is between and , inclusive. The points , , , and are all distinct.
Output Format
For each test case, output YES if the entire painting fits inside some rectangle of finite size. Otherwise, output NO.
3
1 3 -1 3 3 4
1 1 67 0 0 67
67 67 1 0 0 1
YES
NO
YES