Save Your Friend
All submissions for this problem are available.
Omg! Terrorists have kidnapped your best friend because he had extremely good GPA in last semester. You knew it may happen, so you had put a position detecter in his shoes. Now, you have to find him. Suppose whole Dhanbad is divided into a (X,Y) coordinate system. You know the coordinates of your friend’s position by that detector. Now you are given “N” points in an order, so that these N points form a polygon. You have to tell whether your friend is inside it or outside.
Input starts with T, the no. of test cases.
For each test case, first line denotes N, the no. of points in polygon. Then N lines follow telling the coordinates of these N points (coordinates will be integral points only). After that a line containing the coordinates of your friend will follow.
For each test print “Inside” if he is inside the polygon or “Outside” if he is outside the polygon.
Input: 2 3 1 1 2 4 2 3 2 2 5 2 1 8 1 11 4 8 7 2 7 10 2 Output: Inside Outside
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.5, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, CLOJ, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.