Submit | All submissions | Best solutions | Back to list |
CROSSPDCT - Left, right or center? |
Give two points by their coordinates (x, y) which represent a vector, with positive magnitude, direction and sense, your are supposed to answer Q querys, each of those consists of a single point. Use cross product to verify if given point is at right, at left or in the same direction that the given vector.
Input
In the first line, 4 integers separated by a single space, for each of those integers x, |x| <= 106.
In the next line, a single integer Q <= 105 representing the number of queries.
For each of next Q following lines, there's a query composed by two integers x and y separated by a single space, and who holds max(|x|,|y|) <= 105
Output
For each query (in the given order) answer a single line with an "I" if the point associated to the query is at LEFT of the initial vector, a "D" if it's at RIGHT and a "C" if it's in the exactly same direction.
(In Spanish "I" stands for "Izquierda", "D" for "Derecha" and "C" for "Colineal" o "Centro")
Input: 0 0 1 1
3
-1 0
-1 -1
0 -1 Output: I
C
D
Added by: | BerSub |
Date: | 2016-12-05 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 GOSU |