N Queens by murky-satyr

n=readline(),function
q(o,l,x){for(x=l^n?-1:print.apply(0,o);f=++x<n;f&&q(o.concat(x),-~l))for(i=l;f&&i--;f*=v&&i-l-v&&l-i-v)v=o[i]-x}([])

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page