1#!/usr/bin/perl 2use strict; 3 4my $line = <>; 5my ($r, $c) = split ' ', $line; 6my @M; 7for (1..$r) { 8 $line = <>; 9 chomp $line; 10 my @v = split ' ', $line; 11 push @v, $v[0]; 12 $v[0] = 1; 13 push @M, [@v]; 14} 15while (<>) { 16 chomp; 17 my @v = split; 18 if ($v[0] eq 'linearity') { 19 shift @v; 20 shift @v; 21 for (@v) { 22 $M[$_-1][0] = 0; 23 } 24 } 25 elsif ($v[0] eq 'nonnegative') { 26 shift @v; 27 shift @v; 28 for (@v) { 29 push @M, [1, map { ; 0 } (1..$c)]; 30 $M[-1][$_] = 1; 31 } 32 } 33} 34 35print $#M+1, " ", $#{$M[0]}+1, "\n"; 36for (@M) { 37 print join(' ', @$_), "\n"; 38} 39