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:||ADA, ASM, BASH, BF, C, C99 strict, CAML, CLOJ, CLPS, CPP 4.3.2, CPP 6.3, CPP14, CS2, D, ERL, FORT, FS, GO, HASK, ICK, ICON, JAVA, JS, LISP clisp, LISP sbcl, LUA, NEM, NICE, NODEJS, PAS fpc, PAS gpc, PERL, PERL6, PHP, PIKE, PRLG, PYTH, PYTH 3.5, RUBY, SCALA, SCM guile, SCM qobi, ST, TCL, TEXT, WSPC|
Fetching successful submissions
If you are still having problems, see a sample solution here.