Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- use 5.026;
- my %patch;
- my $double;
- my %claims;
- while (<>) {
- my (undef, $id, $l, $t, $w, $h) = split /[#@,:x ]+/;
- $claims{$id} = 1;
- for (my $x = $l; $x < $l+$w; $x++) {
- for (my $y = $t; $y < $t+$h; $y++) {
- if ($patch{$x}{$y}) {
- $double++;
- delete $claims{$patch{$x}{$y}};
- delete $claims{$id};
- } else {
- $patch{$x}{$y} = $id;
- }
- }
- }
- }
- say $double;
- say keys %claims;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement