All pastes #297857 Raw Edit

Mine

public php v1 · immutable
#297857 ·published 2006-12-31 10:35 UTC
rendered paste body
#!/usr/bin/php<?php$input = stream_get_contents(STDIN);$data = explode("\n\n", $input);$num_testcases = intval(array_shift($data));for ($i = 0; $i < $num_testcases; ++$i){	$num_points = intval(array_shift($data));	$look = array();	for ($j = 0; $j < $num_points; ++$j)	{		$look[] = array_shift($data);	}	$h = array();	for ($j = 0; $j < $num_points; ++$j)	{		$h[$j] = $look;		unset($h[$j][$j]);		if (!check($h[$j], $look[$j]))		{			echo('Unsafe Land.');			continue 2;		}	}	var_dump('Safe Land.');}function sign ($num){	if ($num === 0)	{		return 0;	}	return abs($num)/$num;}function check ($points, $point){	$check_point = array_map('intval', explode(' ', $point));	$check_x = $check_point[0];	$check_y = $check_point[1];	$int_points = array();	foreach ($points as $a_point)	{		$data = array_map('intval', explode(' ', $a_point));		if (sign($data[0]) === sign($check_x) && sign($data[1]) === sign($check_y))		{			$int_points[] = array('x' => $data[0], 'y' => $data[1]);		}	}	if (sizeof($int_points) > 1)	{		return false;	}	else	{		return true;	}}?>