Skip to content

Instantly share code, notes, and snippets.

@gfldex
Created February 12, 2017 20:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gfldex/936fa016603f3b1d2fe7a7a4563c151a to your computer and use it in GitHub Desktop.
Save gfldex/936fa016603f3b1d2fe7a7a4563c151a to your computer and use it in GitHub Desktop.
use v6.c;
my $input = Q:to /EOH/;
140 190 1 8
5
140 150 1
150 160 0
160 170 7
170 180 6
180 190 2
EOH
sub MAIN(){
# my $input = slurp;
my ($min-x, $max-x, $min-y, $max-y) = $input.lines[0].split(' ');
my $records = $input.lines[1];
for $max-y … 1 -> $y {
print $y;
for 1 … $records -> $x {
my $data = $input.lines[$x+1].split(' ')[2];
print " ";
print $data >= $y ?? '*' !! ' ';
}
print "\n";
LAST {
my @x-labels = $input.lines[2..∞]».split(' ');
say „ “, @x-labels[*;0].join(' '), „ “, @x-labels[*;1][*-1];
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment