Created
December 18, 2016 14:20
-
-
Save ohesotori/99cadd45f53853883c997700377ed639 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$arr = array(); $maxx = $maxy = 0; | |
while($line=fgets(STDIN)){ | |
$buf = trim($line).PHP_EOL; | |
list($x, $y) = explode(",", $buf); | |
$arr[] = $buf; | |
$maxx = max((int)$x,$maxx); $maxy = max((int)$y,$maxy); | |
} | |
$minx = $maxx; $miny = $maxy; | |
foreach($arr as $buf) { | |
list($x, $y) = explode(",", $buf); | |
$minx = min((int)$x,$minx); $miny = min((int)$y,$miny); | |
} | |
$a = max(($maxx - $minx), ($maxy - $miny)); | |
echo ($a * $a) . "\n"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment