Submit | All submissions | Best solutions | Back to list |
HS10RECT - Two rectangles |
Given 8 integers: -1000 < x1, y1, x2, y2, x3, y3, x4, y4 < 1000.
Check what is the shape of the intersection of two axis-aligned rectangles: P1 = (x1, y1), (x1, y2), (x2, y2), (x2, y1) and P2 = (x3, y3), (x3, y4), (x4, y4), (x4, y3).
- If the rectangles do not intersect print nothing.
- If there is exactly one point in common print point.
- If the intersections of P1 and P2 is a line segment print line.
- If they have a rectangular area in common print rectangle.
Input data specification
The first line contains the number of test cases t (1<=t<1000). Each of the following t lines contains 8 integers: x1, y1, x2, y2, x3, y3, x4, y4.
The area of both rectangles is greater than 0.
Output data specification
For each test case print one word on a separate line: nothing, point, line or rectangle.
Example
Input: 5 1 1 2 2 2 2 3 3 10 1 1 10 12 9 10 12 2 3 10 10 1 4 0 0 1 20 20 1 2 10 10 2 10 20 20 10 20 30 25 1 Output: point line nothing rectangle line
Scoring
By solving this problem you will score 10 points.
Bonus challenge
The registered contestant who solves the problem in the least number of bytes of source code will receive a small gift.
Added by: | kuszi |
Date: | 2011-01-05 |
Time limit: | 1s-1.279s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | ADA95 ASM32 ASM64 BASH BF C CSHARP C++ 4.3.2 CPP C99 CLPS LISP sbcl LISP clisp D ERL FSHARP FORTRAN GO HASK ICON JAVA JS-RHINO LUA NEM NICE OCAML PAS-GPC PAS-FPC PERL PHP PIKE PRLG-swi PYTHON PYTHON3 RUBY SCALA SCM guile SCM qobi ST TCL WHITESPACE |
Resource: | High School Programming League |