1
45 symbols pyth
Sat Nov 12 04:19:48 2016 Sait2000
Vum+hd],Hedf.Am**JahdHKaedeT-JKhT*GUQQ]YjkeMN
2
49 symbols pyth
Fri Oct 21 09:02:28 2016 Sait2000
Vum+hd],Hedf.Am***J-hdHK-edeT+JK-JKhT*GUQQ]YjkeMN
3
54 symbols pyth
Fri Oct 21 08:30:00 2016 Sait2000
=]YVQ=Ym+hd],Nedf.Am***J-hdNK-edeT+JK-JKhT*YUQ)VYjkeMN
4
58 symbols pyth
Mon Sep 19 18:19:24 2016 Sait2000
L?bf.Am***J-hdhhTK-edehT+JK-JKtTm+],tbhded*UQytb]YVyQjkeMN
5
151 symbols python2
Fri Oct 21 07:25:25 2016 Sait2000
N=range(input())
z=[],
for r in N:z=[s+[(-r,c)]for s in z for c in N if~-any(j in(r+i+j,c,c+r+i,c-i-r)for i,j in s)]
for s in z:print`map(max,s)`[1::3]
6
156 symbols python2
Fri Oct 21 07:21:45 2016 Sait2000
N=range(int(input()))
z=[],
for r in N:z=[s+[(-r,c)]for s in z for c in N if~-any(j in(r+i+j,c,c+r+i,c-i-r)for i,j in s)]
for s in z:print`map(max,s)`[1::3]
7
158 symbols perl
Sun Oct 25 00:11:39 2015 vakorol
#!/usr/bin/perl -ln
$,='';sub f{my($a,$r)=@_;@$a-$_||print@$a;for$c(0..$_-1){my($i,$b);for(@$a){$b=1,last if$c==$_||abs$c-$_==$r-$i++}!$b&&f($A=[@$a,$c],$r+1)&&return$A}}f([])
8
158 symbols python3
Thu Oct 20 04:43:34 2016 Sait2000
N,*z=range(int(input())),[]
for r in N:z=[s+[(-r,c)]for s in z for c in N if~-any(j in(r+i+j,c,c+r+i,c-i-r)for i,j in s)]
for s in z:print(*map(max,s),sep='')
9
163 symbols python3
Thu Oct 20 04:35:29 2016 Sait2000
N,*z=range(int(input())),[]
for r in N:z=[s+[(r,c)]for s in z for c in N if~-any(j in(r-i+j,c,c+r-i,c+i-r)for i,j in s)]
for s in z:print(*(j for i,j in s),sep='')
10
166 symbols python3
Thu Oct 20 04:32:46 2016 Sait2000
N,*z=range(int(input())),[]
for r in N:z=[s+[(r,c)]for s in z for c in N if~-any(j in(r-i+j,c,c+r-i,c+i-r)for i,j in s)]
for s in z:print(''.join(str(j)for i,j in s))
11
169 symbols python3
Thu Oct 20 04:27:09 2016 Sait2000
N,*z=range(int(input())),[]
for r in N:z=[s+[(r,c)]for s in z for c in N if~-any(0in(r-i,c-j,c-j+r-i,c-j+i-r)for i,j in s)]
for s in z:print(''.join(str(j)for i,j in s))
12
171 symbols python3
Thu Oct 20 04:23:59 2016 Sait2000
N,*z=range(int(input())),[]
for r in N:z=[s+[(r,c)]for s in z for c in N if~-any(0in(r-i,c-j)or c-j in(r-i,i-r)for i,j in s)]
for s in z:print(''.join(str(j)for i,j in s))
13
172 symbols python3
Thu Oct 20 04:21:20 2016 Sait2000
N,*z=range(int(input())),[]
for r in N:z=[s+[(r,c)]for s in z for c in N if~-any(r==i or c==j or c-j in(r-i,i-r)for i,j in s)]
for s in z:print(''.join(str(j)for i,j in s))
14
176 symbols perl
Sat Oct 24 21:16:53 2015 vakorol
#!/usr/bin/perl -ln
sub f{my($a,$r)=@_;scalar@$a==$_&&print join'',@$a;for$c(0..$_-1){my($i,$b);for(@$a){$b=1,last if$c==$_||abs($c-$_)==$r-$i++}f($A=[@$a,$c],$r+1)&&return$A if!$b}return}f([])
15
178 symbols haskell
Wed Oct 21 09:15:52 2015 YoshikuniJujo
import Data.List
main=interact$unlines.map(>>=show).(\n->f n n[][][]).read
f _ 0 _ _ _=[[]]
f n i l h s=[q:r|q<-[0..n-1]\\(l++h++s),r<-f n(i-1)(fmap pred$q:l)(q:h)(fmap(+1)$q:s)]
16
183 symbols python3
Thu Oct 20 04:08:19 2016 Sait2000
N,*z=range(int(input())),[]
for r in N:z=[s+[(r,c)]for s in z for c in N if~-any(r==i or c==j or c-j in(r-i,i-r)for i,j in s)]
print("\n".join("".join(str(q[1])for q in s)for s in z))
17
184 symbols python3
Thu Oct 20 04:04:43 2016 Sait2000
N=range(int(input()))
z=[[]]
for r in N:z=[s+[(r,c)]for s in z for c in N if~-any(r==i or c==j or c-j in(r-i,i-r)for i,j in s)]
print("\n".join("".join(str(q[1])for q in s)for s in z))
18
198 symbols python3
Thu Oct 20 03:57:49 2016 Sait2000
N=int(input())
z=[[]]
for r in range(N):z=[s+[(r,c)]for s in z for c in range(N)if~-any(r==i or c==j or c-j in(r-i,i-r)for i,j in s)]
print("\n".join(sorted("".join(str(q[1])for q in s)for s in z)))
19
225 symbols python3
Thu Oct 20 03:55:34 2016 Sait2000
N=int(input())
a=lambda r,c,i,j:r==i or c==j or c-j in(r-i,i-r)
z=[[]]
for n in range(N):z=[s+[(n,c)]for s in z for c in range(N)if~-any(a(*(n,c)+q)for q in s)]
print("\n".join(sorted("".join(str(q[1])for q in s)for s in z)))
20
236 symbols python3
Thu Oct 20 03:49:37 2016 Sait2000
N=int(input())
a=lambda r,c,i,j:r==i or c==j or c-j in(r-i,i-r)
z=lambda n:[s+[[n-1,c]]for s in z(n-1)for c in range(N)if~-any(a(*([n-1,c]+q))for q in s)]if n>0else[[]]
print("\n".join(sorted("".join(str(q[1])for q in s)for s in z(N))))
21
273 symbols python3
Thu Oct 20 03:48:55 2016 Sait2000
import functools as f
N=int(input())
a=lambda r,c,i,j:r==i or c==j or c-j in(r-i,i-r)
z=f.lru_cache()(lambda n:[s+[[n-1,c]]for s in z(n-1)for c in range(N)if~-any(a(*([n-1,c]+q))for q in s)]if n>0else[[]])
print("\n".join(sorted("".join(str(q[1])for q in s)for s in z(N))))
22
286 symbols python3
Tue Feb 2 01:04:11 2016 unayok
import functools as f
N=int(input())
a=lambda r,c,i,j:r==i or c==j or c-j in(r-i,-(r-i))
z=f.lru_cache()(lambda n:[s+[[n-1,c]]for c in range(N)for s in z(n-1)if not any(a(*([len(s),c]+q))for q in s)]if n>0 else[[]])
print("\n".join(sorted(["".join(str(q[1])for q in s)for s in z(N)])))
23
366 symbols haskell
Wed Oct 21 09:12:38 2015 YoshikuniJujo
import Control.Applicative
import Data.List

main :: IO ()
main = interact $ unlines . map (>>= show) . (\n -> queens n n [] [] []) . read

queens :: Int -> Int -> [Int] -> [Int] -> [Int] -> [[Int]]
queens _ 0 _ _ _ = [[]]
queens n i ls hs rs = [ q : qs |
	q <- [0 .. n - 1] \\ (ls ++ hs ++ rs),
	qs <- queens n (i - 1) (pred <$> q : ls) (q : hs) (succ <$> q : rs) ]