import java.io.PrintStream; import java.util.Arrays; import java.util.Scanner; /** * Solution to Law 11 * * All measurements are to the opponent's goal line (at x=50). * So, we can completely ignore the y coordinate. * * @author vanb */ public class law11_vanb { private static Scanner sc; private static PrintStream ps; private void doit() { boolean offside = false; // Here's the ball int ball = sc.nextInt(); sc.nextInt(); // Find the most forward offensive player int offense = -100; for( int i=0; i<11; i++ ) { int x = sc.nextInt(); sc.nextInt(); if( x>offense ) offense = x; } // Is the most forward offensive player on the defense's side of the field, // and ahead of the ball? if( offense>0 && offense>ball ) { // Count the number of defensive players ahead of that guy int count = 0; for( int i=0; i<11; i++ ) { int defense = sc.nextInt(); sc.nextInt(); if( defense>offense ) ++count; } // Offside if 1 or fewer defensive players are ahead offside = count<2; } ps.println( offside ? 1 : 0 ); } public static void main( String[] args ) throws Exception { sc = new Scanner( System.in ); ps = System.out; new law11_vanb().doit(); } }