import java.io.PrintStream; import java.util.Arrays; import java.util.Scanner; /** * Solution to Bikes and Barricades * * @author vanb */ public class bikes_vanb { /** Input. */ private static Scanner sc; /** Output. */ private static PrintStream ps; /** * Do it! */ private void doit() { int n = sc.nextInt(); double closest = -1.0; while( n-->0 ) { int x1 = sc.nextInt(); int y1 = sc.nextInt(); int x2 = sc.nextInt(); int y2 = sc.nextInt(); // The input spec says that x1!=0, x2!=0. // If x1==x2, we have a vertical line, which cannot possibly block the road. // If x1*x2>0, then both points are n the same side of the Y axis, the barricade cannot cross. if( x1*x2<0 ) { // The basic equation of a line: y=mx+b! // b is the Y intercept, that's what we want! // m is slope double m = (double)(y2-y1)/(double)(x2-x1); double b = y1 - m*x1; // Scott is going up from (0,0), so if b is negative, it won't be in his way. // If closest<0, it has to be -1.0, which means we haven't seen any blocking barricades yet. if( b>0.0 && (closest<0.0 || b