Skip to content

Commit

Permalink
auto checkin
Browse files Browse the repository at this point in the history
  • Loading branch information
svn committed Aug 1, 2016
1 parent e7565ef commit 0a8cfc0
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions puz.k
Expand Up @@ -8,22 +8,21 @@ x?:-x:-10000
f1:{{&/x@&x>*x}':(!#x)_\:x}
f2:{{&/y@&y>*y_:x}[x]':!#x}

r:{x?1+x:<<x} / next rank

/ O(n*log n) atom
f10:{b::(#x)#0b;{b[x]:1b;b(1+)/1+x}'x}
f11:{{while[y>x z+:1];z}[i,#i]'[i;!#i:<x]x}
f12:{{(y>x@)(1+)/1+z}[i,#i]'[i;!#i:<x]x}
f0:{x@{(y>)x/x y}[x?1+x]':!#x}
f0:{x@{(y>)x/x y}[r x]':!#x}

/ O(n*log n) vector
g0:{x@{y x&y}[!#x]/x?1+x}
g1:{x@{@[y;i;:;y y i:&x>y]}[!#x]/x?1+x}
g2:{x last(*:){(#i;@[y;i;:;y y i:&x>y@:1])}[!#x]/(1;x?1+x)}
g3:{n::x?1+x;{n[x]:n n x@:&x>n x;x}/!#x;x n}
g0:{x@{y x&y}[!#x]/r x}
g1:{x@{@[y;i;:;y y i:&x>y]}[!#x]/r x}
g2:{x last(*:){(#i;@[y;i;:;y y i:&x>y@:1])}[!#x]/(1;r x)}
g3:{n::r x;{n[x]:n n x@:&x>n x;x}/!#x;x n}

g0 1 4 2 6 8

a:`g0`g1`g2`g3
1 .Q.s a!{."\\ts:100 ",x," x"}'$a;
a:`f1`f2`f0`g0`g1`g2`g3

\
1 .Q.s a!{."\\ts ",x," x"}'$a;

g:{y i x@<i:<y} / transform problem to perm

0 comments on commit 0a8cfc0

Please sign in to comment.