Perl 5, 6767 57 + 1 (-n-p) = 6858 bytes
$_=$\=$_=10**$_/10+($_>1).0 x($_-2).1;for$i;for$i(2..lengthy///c){say;s/^.//;$_.=0}s/0$/1/;say}{ Takes the input implicitly (-np). ConvertsConvert that to a string10 to the power of 1 (iffthe input > 0) followed by n-2 zeros, followed by aminus 1 and add one if the input is greater than one. Outputs thethat as a string, then removes first character and appends a 0, looping until it has output n-1 rows. For the last row, replaceimplicitly output the final character with a 1 before printingcopy of the first row which has been stored in $\.