Skip to main content
2 of 2
deleted 8 characters in body
Xcali
  • 16.2k
  • 2
  • 15
  • 39

Perl 5, 67 bytes

sub{map{[grep$_,map{shift@{$_[-$_]}}-$_..0]}0..$#_,($#_)x$#{$_[0]}}

Try it online!

Xcali
  • 16.2k
  • 2
  • 15
  • 39