Perl solutions. The first part was easy, just counting how many times each square occurred. The second part was trickier and the naive solution was too slow, so I summoned some regular expressions to help me:
#!/usr/bin/perlusewarnings;usestrict;usefeatureqw{ say };my%grid;while(<>){my($x,$y,$w,$h)=/#\d+ @ (\d+),(\d+): (\d+)x(\d+)/;formy$j($y..$y+$h-1){formy$i($x..$x+$w-1){++$grid{"$i $j"};}}}sayscalargrep$grid{$_}>1,keys%grid;
#!/usr/bin/perlusewarnings;usestrict;usefeatureqw{ say };my%grid;while(<>){my($id,$x,$y,$w,$h)=/(#\d+) @ (\d+),(\d+): (\d+)x(\d+)/;formy$j($y..$y+$h-1){formy$i($x..$x+$w-1){$grid{"$i $j"}.=$id;}}}my$all=join':',values%grid;my%uniq;undef@uniq{$all=~/(?:^|:)(#\d+)(?:$|:)/g};formy$id(keys%uniq){say($id),lastif$all!~/\d$id/&&$all!~/$id#/;}
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Perl solutions. The first part was easy, just counting how many times each square occurred. The second part was trickier and the naive solution was too slow, so I summoned some regular expressions to help me: