## Perl, <s>47</s> 45 bytes

    @a=1..<>;for(@a){$a=$_;say map{$_==$a?1:0}@a}

Running with the `-E` perlrun:

    $ echo 3 | perl -E'@a=1..<>;for(@a){$a=$_;say map{$_==$a?1:0}@a}'
    100
    010
    001