Exact Cover Puzzle


10

DESAFÍO

Dado un conjunto de letras agrupadas, colóquelas en el tablero para que cubran el área por completo.

Representación de la Junta (también conocido como BARCO DECK)

  • El tablero es una cuadrícula de 6x6.
  • Siempre habrá 36 cuadrados totales.
  • Las columnas están marcadas AF.
  • Las filas están marcadas 1-6.

Ejemplo:

    A   B   C   D   E   F
  +---+---+---+---+---+---+
1 :   :   :   :   :   :   :
  +---+---+---+---+---+---+
2 :   :   :   :   :   :   :
  +---+---+---+---+---+---+
3 :   :   :   :   :   :   :
  +---+---+---+---+---+---+
4 :   :   :   :   :   :   :
  +---+---+---+---+---+---+
5 :   :   :   :   :   :   :
  +---+---+---+---+---+---+
6 :   :   :   :   :   :   :
  +---+---+---+---+---+---+

ENTRADA (también conocido como los cajones)

  • Una cadena multilínea que contiene el conjunto de letras agrupadas.
  • Las cajas están hechas de grupos de letras idénticas.
  • Las cajas son INMUTABLES, lo que significa que no se pueden girar ni voltear.
  • El punto de partida para cada caja está en la parte superior izquierda (debe tenerse en cuenta al mover una caja a la cubierta).
  • Desde el punto superior izquierdo de una caja, los siguientes cuadrados idénticos solo pueden estar a la derecha o debajo.
  • Cualquier letra puede usarse para representar una caja. Las cajas siempre comienzan con letras [a]y suben el alfabeto.
  • Las cajas están etiquetadas por su letra (es decir, caja A, caja B, etc.)
  • El número de cajas puede variar (no siempre es 10, a pesar de los ejemplos dados).
  • Hay 24 caracteres que separan cada bloque de cajas por línea. (inicio de [a] a inicio de [b] separados por 24 caracteres, etc.)

Ejemplo:

[a][a][a]               [b]                     [c][c]               
      [a]               [b][b][b]                  [c]               
      [a]               [b][b]                                       

[d]                     [e]                     [f][f][f][f][f]      
[d][d]                  [e]                                          
[d][d]                  [e]                                          
                        [e]                                          
                        [e][e]                                       

[g]                     [h]                     [i]                  
[g]                                             [i]                  
                                                [i]                  

SALIDA

Es necesario que imprima una serie de comandos que coloquen las cajas en posiciones en la plataforma para que quede completamente cubierta (sin espacios vacíos).

El formato del comando es así:

HAUL <crate> TO <column> <row>

es decir, HAUL E A A 1

Para aclarar, siempre habrá una solución para la entrada dada.

CASOS DE PRUEBA <- Haga clic para más.

Entrada

[a][a][a]               [b]                     [c][c][c]            
   [a][a]               [b]                                          
   [a]                  [b][b]                                       
                        [b][b]                                       

[d]                     [e]                     [f]                  
[d]                                             [f]                  
[d]                                             [f]                  
[d]                                                                  
[d]                                                                  

[g][g]                  [h]                     [i]                  
                                                [i][i]               
                                                   [i]               
                                                   [i][i]            

[j][j][j]                                                            

Salida

HAUL I TO A 1
HAUL B TO A 3
HAUL A TO B 1
HAUL J TO D 6
HAUL D TO F 1
HAUL F TO E 1
HAUL C TO C 5
HAUL G TO D 4
HAUL E TO D 3
HAUL H TO C 6

Resultado:

    A   B   C   D   E   F
  +---+---+---+---+---+---+
1 : i : a : a : a : f : d :
  +---+---+---+---+---+---+
2 : i : i : a : a : f : d :
  +---+---+---+---+---+---+
3 : b : i : a : e : f : d :
  +---+---+---+---+---+---+
4 : b : i : i : g : g : d :
  +---+---+---+---+---+---+
5 : b : b : c : c : c : d :
  +---+---+---+---+---+---+
6 : b : b : h : j : j : j :
  +---+---+---+---+---+---+

PUNTUACIÓN

Este es el por lo que gana la respuesta más corta en caracteres.


¿Se puede suponer que ninguna caja tendrá agujeros?
Jonathan Frech

¿Supongo que puede haber como máximo veintiséis cajas?
Jonathan Frech

Los corchetes de diseño de caja son una parte innecesaria de la entrada, en el sentido de que la entrada podría ser más clara sin ellos, y el diseño es tedioso de analizar. Como es, la etapa de análisis podría ser predominante en las respuestas con respecto a la etapa de resolución de problemas reales. Pero es su desafío después de todo, por lo que debemos seguir sus reglas
edc65

Respuestas:


5

Python 3.6, 435 437 385 331 bytes

Llame F()con la cuerda de la caja.

def R(b,d,i=0):
 if not d:return 1
 (k,x),*d=d
 while x:
  if x&b<1and R(b|x,d):print(f'HAUL {k.upper()} TO {i%7+65:c} {i//7+1}');return 1
  i+=1;x>>=1
def F(t,d={},e={}):
 r=c=0
 for a in t:
  if'`'<a<'{':e[a]=x,y=e.get(a,(r,c));d[a]=d.get(a,0)+(1<<(48-(r-x)*7-(c-y)//3))
  elif'\n'==a:r+=1;c=-1
  c+=1
 R(4432676798719,d.items())

Logré jugar al golf mucho más:

  1. Analiza la cadena de cajas directamente en lugar de usar la rebiblioteca.
  2. Se usó setdefault para guardar la primera coordenada de un conjunto de cajas, de modo que se pueda crear la máscara de bits al analizar la cadena de cajas. Eliminando un bucle for.
Versión anterior
import re
def R(b,d,i=0):
 if not d:return 1
 (k,x),*d=d
 while x:
  if not x&b and R(b|x,d):print(f'HAUL {k.upper()} TO {i%7+65:c} {i//7+1}');return 1
  i+=1;x>>=1
def F(t,d={},n=0):
 for r in t.split('\n'):
  for m in re.finditer(r'(.)]',r):d[m[1]]=d.get(m[1],[])+[(n,m.start())]
  n+=1
 R(4432676798719,[(k,sum(1<<(48-(r-v[0][0])*7-(c-v[0][1])//3)for r,c in v))for k,v in d.items()])

Reestructurado el código para eliminar bucles redundantes.

  1. El código anterior creó una lista de todas las posiciones de una caja F()y luego iteró sobre la lista en R(). El nuevo código crea una posición de una caja F()y R()prueba todas las posiciones posibles.

  2. En el código anterior, R()recopilaba una posible solución ay F()luego iteraba sobre la solución devuelta. En el nuevo código, R()imprime los comandos HAUL directamente

Versión previa
import re
def R(b,d,a=[]):
 if not d:yield a
 for x in d[0]:
  if not x&b:yield from R(b|x,d[1:],a+[x])
def F(t,d={},n=0):
 for r in t.split('\n'):
  for m in re.finditer(r'(.)]',r):d[m[1]]=d.get(m[1],[])+[(n,m.start())]
  n+=1
 for k,j in enumerate(next(R(4432676798719,[[sum(1<<(48-(r-v[0][0])*7-(c-v[0][1])//3)for r,c in v)>>i for i in range(48)]for k,v in d.items()]))):x=51-len(bin(j));print(f'HAUL {k+65:c} TO {x%7+65:c} {x//7+1}')

Explicación

La idea básica es representar la cubierta del barco y las cajas como mapas de bits. Mediante el uso de mapas de bits, mover una caja se convierte en un cambio de su mapa de bits y la comprobación de la superposición entre cajas se convierte en un AND en bits y prueba de cero.

Código sin golf:

import re

def F(crate_string):                                                                 #  3
  coords = {} 
  row_no = 0 

  for row in crate_string.split('\n'):                                               #  7

    for match_obj in re.finditer('(.)]', row):                                       #  9

      crate_name = match_obj[1]                                                      # 11
      col_no = match_obj.start()                                                     # 12
      coords[crate_name] = coords.get(crate_name, []) + [(row_no, col_no)]           # 13

    row_no += 1

  normed = {k:[(r-v[0][0], (c-v[0][1])//3) for r,c in v] for k,v in coords.items()}  # 17
  bitmaps = [(k,sum(1<<(48 - r*7 - c) for r,c in v)) for k,v in normed.items()]      # 18

  R(4432676798719, bitmaps)                                                          # 20

def R(used, bitmaps):                                                                # 22
  if not bitmaps:                                                                    # 23
    return True                                                                      # 24
  shift = 0                                                                          # 25
  (crate_name, crate_bitmap),*bitmaps = bitmaps                                      # 26

  while crate_bitmap:                                                                # 28
    if not used & crate_bitmap:                                                      # 29
      if R(used | crate_bitmap, bitmaps):                                            # 30
        print(f'HAUL {crate_name.upper()} TO {shift%7 + 65:c} {shift//7 + 1}')       # 31
        return True                                                                  # 32

    shift += 1                                                                       # 34
    crate_bitmap >>= 1                                                               # 35

  return False                                                                       # 37

F()analiza la cadena de definición de caja y construye los mapas de bits. Una expresión regular busca (línea 9) cada línea de la cadena de definición de caja en busca de cajas (una letra seguida de un ']'). Cuando se encuentra una coincidencia, la correspondiente (fila, col) se agrega a un diccionario con la letra (líneas 11-13). Para el ejemplo de cadena de definición de caja dada en el problema:

coords = {'a': [(0, 5), (0, 8), (0, 11), (1, 5), (1, 8), (1, 11)], 
          'b': [(0, 29), (1, 29), (2, 29)], 
               ... }

Las coordenadas de cada caja están normalizadas (línea 17), de modo que cada caja comienza en (0,0) y cada bloque tiene una unidad de ancho (en lugar de 3 a la '[a]').

normed = {'a': [(0, 0), (0, 1), (0, 2), (1, 0), (1, 1), (1, 2)],
          'b': [(0, 0), (1, 0), (2, 0)],
               ... }

Luego se crea un mapa de bits para cada caja en función de las coordenadas normalizadas (línea 18).

La plataforma se trata como una cuadrícula de 7 x 7. La columna 'G' y la fila 7 se utilizan para detectar cuándo una forma se extiende fuera del tablero. Un mapa de bits tiene un 1 si las cajas ocuparían el cuadrado correspondiente en la cubierta. Los bits 48 a bit 42 corresponden a los cuadrados A1 a A7, los bits 41 a 35 corresponden a los cuadrados B1 a B7, y así sucesivamente.

bitmaps = [('a', 0b1110000_1110000_0000000_0000000_0000000_0000000_0000000),
           ('b', 0b1000000_1000000_1000000_0000000_0000000_0000000_0000000),
           ...
           ]

R(used, bitmaps)luego usa los mapas de bits para buscar recursivamente ubicaciones de cajas que no intentan colocar dos cajas en el mismo cuadrado. usedes una máscara de bits que indica qué cuadrados no se pueden usar porque ya están ocupados por una caja o porque están fuera del tablero (es decir, la columna G y la fila 7). bitmapses una lista de cajas que aún deben colocarse.

El caso base para la recursión es cuando no quedan más cajas para colocar, es decir, bitmapsestá vacío (línea 23). En este caso, se devuelve True para indicar que se ha encontrado una solución.

De lo contrario, un nombre de caja y su mapa de bits se extraen de la lista de mapas de bits (línea 26). Si bien el mapa de bits de la caja no está vacío (línea 28), verifique si la ubicación de la caja actual, representada por el mapa de bits de la caja, entra en conflicto con las cajas colocadas previamente. En la línea 29, not used & crate_bitmapes Falso si usedy crate_bitmapambos tienen un 1 en la misma posición de bit, lo que indica un conflicto. Si no hay un conflicto, R()se llama de forma recursiva (línea 30) para intentar colocar las cajas restantes.

Si la llamada recursiva a R()devuelve True, significa que se ha encontrado una solución y que la ubicación actual de las cajas es parte de esa solución. Por lo tanto, se imprime el comando correspondiente para mover las cajas y True se propaga por las llamadas recursivas (líneas 31-32).

Cuando se crea en F(), cada mapa de bits de caja representa los cuadrados de la cubierta que serían ocupados por las cajas si se colocan en la posición A1. Cambiar un mapa de bits un bit a la derecha corresponde a mover las cajas a la posición A2. Un desplazamiento a la derecha de siete bits corresponde a mover las cajas a B1, etc. Por ejemplo, los siguientes mapas de bits representan cajas 'a' en varias posiciones:

0b1110000_1110000_0000000_0000000_0000000_0000000_0000000  represent crates 'a' at A1
0b0111000_0111000_0000000_0000000_0000000_0000000_0000000  represent crates 'a' at A2
0b0011100_0011100_0000000_0000000_0000000_0000000_0000000  represent crates 'a' at A3
                                 ...
0b0000000_1110000_1110000_0000000_0000000_0000000_0000000  represent crates 'a' at B1
                                 ...

Si una posible colocación de cajas no funciona porque entra en conflicto con una caja previamente colocada (línea 30) o porque no hay una ubicación válida de las cajas restantes (línea 31). Las cajas se mueven a una posición diferente desplazando la máscara de bits un bit hacia la derecha (línea 35). Shiftrealiza un seguimiento de cuántos lugares se ha desplazado el mapa de bits, que corresponde a la posición actual de las cajas.

Si el mapa de bits está vacío (cero), indica que se han intentado todas las ubicaciones posibles. Se devuelve falso (línea 37) para indicar un error, de modo que una llamada R()anterior a la recursión intentará otra ubicación para sus cajas.

Para garantizar que las cajas no se extiendan por el costado de la plataforma, los bits correspondientes a la columna G y la fila 7 se configuran usedpara la llamada inicial a R()(línea 20).

4432676798719 es la cubierta vacía correspondiente a 0b0000001000000100000010000001000000100000011111111


¡Buen trabajo! Sin embargo, acabo de probar esto en uno de los casos de prueba y trató de transportar una caja a una fila 0, pero esa no es una fila válida. Solo hay filas 1-6. Piensa que solo necesita un +1 para la división. :)
Jonathan Picazo

@JMPicazo: lo arregló.
RootTwo

5

Python 2 , 864 bytes

  • Gracias a Stephen por encontrar un error.
  • El análisis de la cadena podría jugarse de manera significativa, ya que el formato de entrada es más estricto de lo que puede manejar.
def V(C,S=0,D=-1,J=0,H=[],E=enumerate,R=range,r=str.replace,s=str.split,e="!"):
 if[]<C*0:
	J=0;N=[J]*26;K=[]
	for c in s(r(r(r(C,"[",""),"]",""),"   ","*"),2*"\n"):
	 c=[list(_)for _ in s(c,"\n")]
	 for x,_ in E(c[0]):
		if all(c[y][x]<">"for y,_ in E(c)):
		 for y,_ in E(c):c[y][x]=e
	 for j,y in E(c):
		y="".join(y)
		while"!!"in y:y=r(y,2*e,e)
		c[j]=s(y,e)
	 K+=[],[],[],[];J+=4
	 for y in c:
		while""in y:y.remove("")
		for j,x in E(y):K[j+J-4]+=x,
	for k in K:
	 if all(k)and k:N[ord(k[0][0])-97]=[[x>"*"for x in y]for y in k]
	while 0in N:N.remove(0)
	C=N
 if[]>S:S=[0]*36
 if-~D>0:
	Y=J/6;j=0
	for y in C[D]:
	 X=J%6
	 for x in y:
		if x:
		 if X>5or Y>5or S[X+Y*6]:return
		 S[X+Y*6]=x
		X+=1
	 Y+=1
 if~-len(C)==D:
	if 0in S:return
	for h in H[1:]+[J]:print"HAUL %c TO %c %d"%(65+j,65+h%6,h/6+1);j+=1
	j/0
 for j in R(36):V(C,S[:],-~D,j,H*(D>=0)+[J])

Pruébalo en línea!

Explicación

Se utilizan muchos bytes para analizar las cajas bidimensionales ingresadas a través de una sola cadena. Las cajas se representan como una lista anidada de valores booleanos.
Después de analizar las cajas, la función considera todas las posiciones posibles de todas las cajas. Para hacerlo, se llama iterativamente a sí mismo. Cuando encuentra una posición imposible (si la caja se coloca fuera de la cubierta o encima de otra caja), mata la rama del árbol de recursión actual para mejorar el rendimiento.
Cuando ve que una determinada combinación de ubicaciones dio como resultado una cubierta completamente cubierta, imprime el historial de ubicación de cajas registrado y se cierra globalmente al intentar una división desesperada. Las instrucciones de transporte impresas incluso se ordenan alfabéticamente.


Python 2 , 812 bytes

def f(C,M=[],d=0,R=range,E=enumerate,L=len):
 if C*0=="":
	N=[0]*26;K=[];J=0
	r=str.replace
	for c in r(r(r(C,"[",""),"]",""),"   ","*").split("\n\n"):
	 c=[list(_)for _ in c.split("\n")]
	 for x in R(L(c[0])):
		if all(c[y][x]=="*"for y in R(L(c))):
		 for y in R(L(c)):c[y][x]="!"
	 for j,y in E(c):
		y="".join(y)
		while"!!"in y:y=r(y,"!!","!")
		c[j]=y.split("!")
	 for _ in"_"*L(c):K+=[],
	 for y in c:
		for j,x in E(y):K[j+J]+=x,
	 J+=L(c)
	for k in K:
	 if all(k)and k:N[ord(k[0][0])-97]=[[x!="*"for x in y]for y in k]
	while 0in N:N.remove(0)
	C=N
 if d==L(C):
	j=0;S=[j]*36
	for c,k in E(C):
	 Y=M[c]/6
	 for y in k:
		X=M[c]%6
		for x in y:
		 if X<6>Y:S[X+Y*6]|=x
		 X+=1
		Y+=1
	if 0in S:return
	for m in M:print"HAUL %c TO %c %d"%(65+j,65+m%6,1+m/6);j+=1
	j/0
 for j in R(36):f(C,M*(d>=0)+[j],d+1)

Pruébalo en línea!

Explicación

La cadena de cajas se analiza y transforma en un nido de booleanos que representa cada caja.
Una función iterativa genera todas las listas posibles de longitud igual a la cantidad de cajas que contienen los enteros 0 <= x < 36(todas las posiciones posibles de la cubierta del barco). Cada lista se interpreta como una instrucción para colocar todas las cajas y probarlas. Si la lista de instrucciones probadas da como resultado un mazo sin espacios vacíos, la lista de instrucciones tiene que ser válida y se imprime.
Al ser extremadamente ineficiente, no lo probé en el caso de prueba proporcionado, aunque en escenarios con menos cajas (ver el enlace TIO). Debido a que el algoritmo busca en todos los arreglos posibles, trata 36**10 = 3.656e15de verlos. Sin embargo, en teoría , aún debería funcionar.


Si puede hacer que funcione con los casos de entrada proporcionados, entonces eso haría que esta respuesta valga la pena. :) De lo contrario, buen trabajo y esta es información útil!
Jonathan Picazo

@JonathanMicaelPicazo personas en código de golf como escribir respuestas que son un par de bytes más corto, pero podría terminar después de la muerte térmica del universo ...
Stephen

(Lamentablemente) probablemente necesitará mover los valores predeterminados para H/ Mfuera de la declaración de función, ya que tenerlos en la declaración hace que las funciones no sean reutilizables. Buen viejo Python.
Stephen

1
@ JonathanMicaelPicazo Espero haber arreglado mi analizador de cadenas y vinculado a sus nuevos casos de prueba. Cajón número tres tarda demasiado tiempo en TIO, aunque si cambias caja [i]con [b], que funciona . El algoritmo podría mejorarse clasificando primero las cajas para que las más grandes se prueben antes que las pequeñas.
Jonathan Frech

1
@JonathanFrech Ya veo ... bueno, ¿estaría dispuesto a hacer un esfuerzo adicional y mejorarlo para que clasifique las cajas de las más voluminosas a las menos voluminosas? Le he estado dando muchos casos de prueba diferentes, y algunos de ellos se resuelven muy rápidamente, mientras que otros la mayoría de las veces se agota el tiempo de espera o incluso se quedan sin resolver ... Lo entendería si no tiene el tiempo, pero Me imagino que al menos vale la pena preguntar!
Jonathan Picazo

2

JavaScript, 366

k=>(x=y=0,C={},B=[...k].map((c,p)=>(c<' '?(x=0,++y):c<'a'?++x:(c=C[c=parseInt(c,36)]||(C[c]=[[],x,y]))[0].push((y-c[2])*7+(x++-c[1])/3),p<8|p>48|p%7<1)),S=[],R=i=>!C[i]||B.some((v,p)=>v?0:C[i][0].every(q=>B[q+=p]?0:B[q]=i)&&R(i+1,S[i-10]=p)||!C[i][0].map(q=>B[q+=p]==i?B[q]=0:0)),R(10),S.map((v,c)=>`HAUL ${(c+10).toString(36)} TO ${(v%7+9).toString(36)} ${v/7|0}`))

Nota: esta función puede analizar una entrada más compacta, ya que no le importa el espacio entre 24 caracteres y se permiten agujeros en las cajas.

Creo que podría jugarse un poco más, pero ahora es corto y no demasiado lento, así que me gusta como está

Menos golf

k=>(
  // input parsing
  var x = 0, y = 0, // current position   
      C = []; // crates 
  [...k].forEach( c => 
  c < ' ' 
  ? (x = 0, ++y) // found a newline, increment y, reset x
  : c < 'a'
    ? ++x // not a letter, increment x
    : (  // found a letter, update the crate
        c = parseInt(c,36), // letter to number (10..35)
        c = C[c], // current crate in c
        c || (C[c]=[[], x, y]), // if new crate, initialize it setting base position
        c[0].push((y - c[2])*7 + (x-c[1])/3) // add current position
        ++x // increment x also
      )
  );
  var B = [...Array(7*8)] // empty board. in golfed code I reuse k to build B. k is big enough
  B = B.map( (_, p) => // set borders
     p < 8 | p > 48 | p%7<1
  )   
  var S = [] // output steps

  // recursive function to fill board
  var R = i => 
    ! C[i] // if crate at position i exists (else, we have found a solution and return true)
    ||
    B.some( (v,p) => // try to put crate at each position in B
      v // current cell is used already ?
      ? 0 // used, return false
      : C[i][0].every( q => // try this position, must place every part 
          B[q+=p] // current position in B is used ?
          ? 0 // used, stop, return false
          : B[q]=i // mark as used
        ) 
        && R(i+1,S[i-10]=p) // ok for current crate, try next, mark step
        || // else, fail for current crate, clear position marked
        !C[i][0].map(q => 
          B[q+=p]==i ? B[q]=0:0 // clear if it was set to 'i'
        )
    ),
  R(10) // start recursive fill at position 10 (that is 'a')
  // it returns true if ok, but we don't care as we are assured a solution exists
  // now just format output
  return S.map((v,c)=>`HAUL ${(c+10).toString(36)} TO ${(v%7+9).toString(36)} ${v/7|0}`)
)

Casos de prueba muchos de ellos

var F=
k=>(x=y=0,C={},B=[...k].map((c,p)=>(c<' '?(x=0,++y):c<'a'?++x:(c=C[c=parseInt(c,36)]||(C[c]=[[],x,y]))[0].push((y-c[2])*7+(x++-c[1])/3),p<8|p>48|p%7<1)),S=[],R=i=>!C[i]||B.some((v,p)=>v?0:C[i][0].every(q=>B[q+=p]?0:B[q]=i)&&R(i+1,S[i-10]=p)||!C[i][0].map(q=>B[q+=p]==i?B[q]=0:0)),R(10),
// Just for debug: return the fill in addition to the steps
[B.slice(7,50).map((c,i)=>i%7?c.toString(36):'\n'),
S.map((v,c)=>`HAUL ${(c+10).toString(36)} TO ${(v%7+9).toString(36)} ${v/7|0}`)])

var Test = [
 "[a][a][a]               [b]                     [c][c]\n      [a]               [b][b][b]                  [c]\n      [a]               [b][b]\n\n[d]                     [e]                     [f][f][f][f][f]\n[d][d]                  [e]\n[d][d]                  [e]\n                        [e]\n                        [e][e]\n\n[g]                     [h]                     [i]\n[g]                                             [i]\n                                                [i]"
,"[a][a][a]               [b]                     [c][c][c]\n   [a][a]               [b]\n   [a]                  [b][b]\n                        [b][b]\n\n[d]                     [e]                     [f]\n[d]                                             [f]\n[d]                                             [f]\n[d]\n[d]\n\n[g][g]                  [h]                     [i]\n                                                [i][i]\n                                                   [i]\n                                                   [i][i]\n\n[j][j][j]"
,"[a]                     [b][b][b]               [c]\n[a]                           [b]\n[d]                     [e]                     [f][f]\n[d]                     [e]\n[d][d][d]\n[g]                     [h]                     [i]\n[g]                     [h][h][h]               [i]\n                              [h]               [i][i]\n                              [h]                  [i]\n                                                   [i]\n[j]                     [k][k][k]\n[j]\n[j]"
,"[a][a][a][a]            [b][b][b]               [c]\n                              [b]               [c]\n                              [b]               [c][c]\n                                                   [c][c]\n[d]                     [e]                     [f]\n[d]                                             [f][f][f]\n[g]                     [h]                     [i][i]\n                        [h][h][h]               [i][i]\n                           [h][h]\n[j]\n[j]\n[j]"
,"[a]                     [b]                     [c][c]\n[a]                     [b]\n[a]\n[d][d]                  [e]                     [f][f][f]\n[d][d][d]\n[g]                     [h]                     [i]\n                        [h]\n                        [h]\n                        [h][h]\n                           [h]\n[j]                     [k][k][k]\n[j][j]                     [k][k]\n[j][j][j]                     [k]"
,"[a]                     [b][b][b]               [c]\n[a]                                             [c]\n                                                [c]\n[d][d]                  [e]                     [f]\n[d][d][d][d]            [e]                     [f]\n                        [e][e][e][e]            [f]\n[g]                     [h][h][h]               [i][i][i]\n                              [h]               [i][i][i]\n[j][j]"
,"[a]                     [b]                     [c][c][c]\n                        [b]\n[d]                     [e][e]                  [f][f]\n[d][d][d]                                       [f][f]\n[d][d]\n[g]                     [h][h][h]               [i]\n[g]                           [h]               [i][i]\n[g]                           [h]               [i][i]\n[g]\n[g]\n[j]\n[j]\n[j]"
,"[a][a]                  [b]                     [c]\n   [a][a]               [b][b]                  [c]\n                        [b][b][b]               [c]\n[d]                     [e][e][e]               [f][f][f]\n[d]                     [e][e][e]\n[g][g]                  [h]                     [i]\n                                                [i]\n                                                [i][i]\n[j][j]\n   [j]\n   [j]\n   [j]"
,"[a][a]                  [b]                     [c]\n[a][a]                  [b][b]                  [c]\n                        [b][b][b]\n[d][d]                  [e]                     [f][f][f]\n[g]                     [h]                     [i][i]\n[g]                     [h]                        [i]\n[g]                     [h]\n[g]\n[g][g]\n[j]\n[j]\n[j]\n[j][j]\n   [j]"
,"[a]                     [b]                     [c][c][c][c][c]\n                        [b]\n                        [b][b][b]\n                              [b]\n[d]                     [e]                     [f][f][f]\n                        [e]\n                        [e]\n                        [e][e][e]\n[g]                     [h]                     [i]\n[g]                     [h]\n[g]                     [h]\n                        [h]\n[j][j]                  [k]\n[j][j]                  [k]"
,"[a]                     [b]                     [c]\n                                                [c]\n                                                [c]\n[d][d][d]               [e]                     [f]\n                        [e][e][e]               [f]\n                                                [f][f][f]\n                                                   [f]\n[g][g][g]               [h][h]                  [i]\n[g][g][g]                                       [i][i]\n                                                [i][i]\n[j]                     [k]\n[j]                     [k]\n[j]"
,"[a][a]                  [b]                     [c]\n                        [b]                     [c][c][c]\n                        [b]                           [c]\n                        [b][b]                        [c]\n                           [b]\n[d]                     [e]                     [f]\n[d]\n[g]                     [h]                     [i]\n[g][g][g]               [h]                     [i]\n                        [h][h][h]               [i]\n                              [h]\n[j][j][j]               [k][k]"
,"[a][a]                  [b][b][b]               [c]\n                        [b][b][b]\n[d]                     [e]                     [f]\n[d]                     [e]                     [f]\n                        [e]                     [f]\n                        [e][e]\n                           [e]\n[g][g][g]               [h][h]                  [i]\n                        [h][h]                  [i]\n                        [h][h]                  [i][i]\n                                                   [i]\n                                                   [i]\n[j]"
,"[a][a][a]               [b][b]                  [c][c]\n                        [b][b]                  [c][c]\n                        [b][b]                  [c][c]\n[d][d]                  [e]                     [f][f]\n   [d]                  [e]\n                        [e]\n                        [e]\n                        [e]\n[g]                     [h]                     [i][i]\n[g]                                             [i][i]\n[g]\n[g]\n[g][g]"
,"[a][a][a]               [b]                     [c]\n      [a]                                       [c]\n      [a]\n[d]                     [e][e][e]               [f][f]\n[d]\n[g]                     [h][h]                  [i]\n[g][g][g]               [h][h]                  [i]\n   [g][g]                                       [i]\n[j]                     [k]\n[j]                     [k]\n[j][j]\n   [j]\n   [j]"
,"[a][a]                  [b]                     [c][c]\n                        [b][b]\n                        [b][b][b]\n[d]                     [e][e][e]               [f][f]\n                        [e][e][e]                  [f][f][f]\n[g]                     [h]                     [i][i]\n[g]                     [h]                     [i][i]\n[g]                                             [i][i]\n[j][j][j]"
,"[a][a]                  [b][b][b]               [c]\n   [a]                     [b][b]\n   [a][a][a]\n[d][d]                  [e]                     [f]\n[d][d]                  [e][e]                  [f][f][f]\n                        [e][e]\n                           [e]\n[g][g][g]               [h]                     [i]\n                                                [i]\n                                                [i]\n                                                [i]\n[j][j]"
,"[a]                     [b][b]                  [c]\n[a]                                             [c]\n[a]\n[a][a][a]\n[d]                     [e][e][e][e]            [f]\n[d]                                             [f]\n                                                [f]\n[g]                     [h]                     [i]\n[g]                     [h][h]\n[g]                     [h][h][h]\n[g]\n[g][g]\n[j]                     [k][k]\n                           [k]"
,"[a]                     [b][b]                  [c]\n[a]                     [b][b][b]               [c]\n[a][a][a][a]                                    [c]\n[d][d][d]               [e]                     [f]\n   [d][d]               [e]\n[g]                     [h]                     [i]\n                        [h]                     [i]\n                        [h]\n                        [h]\n                        [h][h]\n[j][j][j][j][j]"
,"[a][a]                  [b][b]                  [c]\n   [a][a][a]\n   [a]\n[d]                     [e][e][e]               [f][f]\n[d]\n[g]                     [h][h]                  [i]\n[g]                     [h][h]\n[g]                     [h][h]\n[g]\n[j]                     [k]\n[j][j]                  [k][k]\n                        [k][k]\n                           [k]"
,"[a][a][a]               [b]                     [c]\n                                                [c]\n                                                [c][c][c][c]\n[d]                     [e][e][e]               [f][f][f]\n[d]                     [e][e][e]               [f][f][f]\n[d]\n[g]                     [h][h]                  [i][i]\n[g]                                             [i][i]\n[j]\n[j]\n[j]"
,"[a]                     [b]                     [c][c]\n                        [b]                     [c][c]\n                        [b]\n[d][d][d]               [e]                     [f]\n      [d]                                       [f]\n                                                [f]\n[g]                     [h]                     [i]\n[g]                     [h][h][h]               [i][i]\n                        [h][h]                  [i][i][i]\n[j]                     [k]                     [l][l][l][l]"
,"[a]                     [b]                     [c]\n[a][a]                  [b]\n[a][a]\n[d]                     [e]                     [f]\n[d]                     [e]\n[d]                     [e][e][e]\n[d]                        [e]\n[g]                     [h][h][h]               [i][i]\n[g][g]\n[j][j][j]               [k]\n[j][j][j]               [k]\n                        [k]"
,"[a]                     [b]                     [c][c]\n[a][a][a]               [b]                     [c][c]\n   [a][a]               [b]\n                        [b]\n                        [b][b]\n[d]                     [e]                     [f]\n[d]                     [e]\n[d]\n[g]                     [h][h][h][h]            [i]\n[j][j]                  [k]\n                        [k]\n                        [k][k]\n                           [k]\n                           [k]"
,"[a]                     [b][b][b]               [c]\n[a]                     [b][b][b]               [c][c][c]\n[a]\n[d]                     [e]                     [f][f][f][f]\n                        [e]\n                        [e]\n                        [e]\n                        [e]\n[g]                     [h]                     [i]\n                        [h][h]                  [i]\n                        [h][h]                  [i][i][i]\n                                                   [i]\n[j]"
,"[a][a][a]               [b]                     [c]\n                        [b]                     [c]\n                        [b][b][b]\n                              [b]\n[d][d][d]               [e][e]                  [f]\n                        [e][e]                  [f]\n                                                [f]\n                                                [f][f][f]\n[g]                     [h]                     [i]\n[g]                                             [i]\n[g]                                             [i]\n                                                [i]\n                                                [i][i]\n[j][j]"
,"[a]                     [b]                     [c]\n[a]                     [b]\n[a][a]                  [b]\n[d]                     [e][e][e]               [f]\n[d]                           [e]               [f]\n                              [e]               [f]\n                              [e]               [f][f]\n                                                   [f]\n[g][g]                  [h]                     [i]\n                                                [i]\n[j][j][j]               [k]\n                        [k][k][k]\n                        [k][k]"
,"[a][a][a]               [b][b]                  [c]\n                           [b]                  [c]\n[d]                     [e][e]                  [f]\n[d]                                             [f]\n[d][d]\n   [d][d]\n[g]                     [h]                     [i]\n                        [h]\n                        [h]\n[j][j]                  [k]                     [l]\n[j][j][j]               [k]                     [l][l][l]\n      [j]               [k]"
,"[a][a]                  [b]                     [c][c][c]\n[d]                     [e][e]                  [f][f]\n[d]                     [e][e]                  [f][f]\n[d]\n[d]\n[g]                     [h][h][h]               [i]\n[g]                                             [i]\n[g]\n[g][g][g]\n[j]                     [k]\n[j]\n[j][j][j][j]"
,"[a][a][a]               [b][b]                  [c]\n[d]                     [e]                     [f]\n[d][d][d]                                       [f][f][f][f]\n[d][d]                                                   [f]\n[g][g]                  [h][h][h]               [i]\n                                                [i]\n                                                [i]\n[j]                     [k]                     [l]\n[j]                                             [l]\n                                                [l][l]\n                                                [l][l]"
,"[a][a][a]               [b]                     [c]\n                        [b]                     [c]\n                                                [c]\n[d][d]                  [e][e]                  [f]\n   [d]\n   [d]\n   [d]\n[g]                     [h]                     [i][i]\n[g][g]                  [h]                     [i][i][i]\n                        [h][h][h]                     [i]\n                              [h]\n[j][j]                  [k]\n[j][j]"
,"[a]                     [b][b][b]               [c]\n[a]                           [b]               [c]\n[a][a]                        [b]               [c]\n   [a][a]\n[d]                     [e][e][e]               [f][f]\n[d][d][d]                                       [f][f]\n   [d][d]\n[g]                     [h]                     [i][i]\n[j]                     [k]\n[j]                     [k][k]"
,"[a]                     [b]                     [c]\n                                                [c]\n                                                [c][c]\n                                                   [c][c]\n[d][d][d][d][d]         [e]                     [f][f]\n                                                [f][f]\n[g]                     [h]                     [i][i]\n[g]                     [h][h]                  [i][i]\n[g]                                             [i][i]\n[g]\n[g]\n[j][j]\n[j][j]"
,"[a]                     [b][b]                  [c][c]\n                           [b]                  [c][c]\n                           [b]\n[d][d]                  [e][e]                  [f]\n[d][d][d]               [e][e][e]\n[g]                     [h]                     [i]\n[g]                     [h]\n[g][g][g][g]            [h]\n                        [h]\n                        [h]\n[j][j][j][j]"
,"[a]                     [b][b][b]               [c][c][c]\n[a]                        [b][b]\n[a]\n[a][a]\n   [a]\n[d]                     [e]                     [f]\n[d]                                             [f]\n[d]                                             [f]\n[g]                     [h]                     [i][i]\n[g][g]                  [h]                     [i][i]\n[g][g][g]\n[j]                     [k][k]"
,"[a]                     [b][b]                  [c]\n[a]                     [b][b]\n                        [b][b]\n[d]                     [e]                     [f][f][f]\n[d][d][d]\n[d][d]\n[g]                     [h]                     [i][i]\n[g]                     [h]\n[g]\n[j][j][j]               [k]\n      [j]               [k]\n                        [k]\n                        [k][k]\n                           [k]"
,"[a][a][a]               [b]                     [c]\n   [a][a]\n[d][d][d]               [e]                     [f][f]\n                        [e]\n[g]                     [h]                     [i]\n[g][g]                  [h]                     [i]\n[g][g][g]               [h]                     [i]\n[j]                     [k][k]\n[j][j]                  [k][k][k]\n[j][j]"
,"[a][a][a]               [b]                     [c][c][c][c][c]\n   [a][a]               [b]\n      [a]               [b]\n                        [b]\n[d]                     [e]                     [f]\n[d][d]                                          [f]\n[d][d][d]                                       [f]\n[g]                     [h][h]                  [i][i][i]\n                        [h][h]                  [i][i][i]"
,"[a][a]                  [b]                     [c]\n                        [b]\n                        [b]\n[d][d][d]               [e]                     [f]\n                                                [f]\n                                                [f]\n                                                [f]\n[g][g][g]               [h][h]                  [i]\n[g][g][g]               [h][h]                  [i][i]\n                                                [i][i][i]\n[j][j][j]\n   [j][j]\n      [j]"
,"[a]                     [b]                     [c]\n[a]                                             [c]\n[a]                                             [c]\n[a]                                             [c][c][c]\n[a][a]\n[d]                     [e]                     [f]\n                        [e]\n                        [e]\n[g][g]                  [h][h]                  [i][i][i]\n[g][g]\n[g][g]\n[j]                     [k][k][k]\n[j]\n[j]\n[j]"
,"[a][a][a]               [b]                     [c]\n      [a][a]            [b][b]                  [c]\n      [a]               [b][b][b]               [c]\n                                                [c]\n[d]                     [e][e][e]               [f]\n[d][d][d]\n[d][d]\n[g]                     [h]                     [i][i]\n                                                [i][i]\n[j]                     [k][k]\n[j]"
,"[a]                     [b][b]                  [c]\n                                                [c]\n                                                [c][c]\n                                                [c][c]\n[d]                     [e][e][e]               [f][f]\n[d][d][d]                                          [f][f]\n                                                      [f]\n[g]                     [h]                     [i]\n                                                [i][i]\n                                                   [i][i]\n                                                      [i]\n[j]                     [k]                     [l][l]\n[j]\n[j]\n[j]"
,"[a]                     [b]                     [c][c][c]\n[a]                     [b]                        [c][c]\n[a]                     [b]\n[a]\n[a][a]\n[d]                     [e]                     [f][f]\n                        [e][e]\n                        [e][e]\n                           [e]\n[g]                     [h]                     [i][i]\n                                                [i][i]\n                                                [i][i]\n[j]                     [k][k][k]\n[j]"
,"[a][a][a]               [b]                     [c]\n                                                [c]\n                                                [c]\n                                                [c][c]\n                                                   [c]\n[d][d][d]               [e]                     [f]\n      [d]                                       [f]\n                                                [f]\n[g][g]                  [h]                     [i]\n                        [h]                     [i][i][i]\n                                                [i][i]\n[j][j]                  [k]\n[j][j]                  [k]\n[j][j]"
,"[a][a]                  [b][b]                  [c][c]\n                           [b][b]\n                              [b]\n[d]                     [e][e][e]               [f]\n[d]                     [e][e][e]               [f]\n[d][d]\n   [d][d]\n[g][g][g]               [h]                     [i]\n                        [h]                     [i][i]\n                        [h]\n[j]                     [k]\n                        [k]\n                        [k]"
,"[a][a][a]               [b][b]                  [c]\n      [a]                                       [c][c][c]\n                                                [c][c]\n[d]                     [e]                     [f]\n                                                [f]\n                                                [f]\n                                                [f]\n[g]                     [h][h]                  [i][i][i]\n[g]                     [h][h]\n[g]                     [h][h]\n[g][g][g]\n[j][j][j]"
,"[a][a]                  [b][b]                  [c][c][c][c][c]\n[a][a][a]                  [b]\n[d]                     [e][e][e]               [f]\n[d]                     [e][e][e]               [f]\n[d][d][d][d]                                    [f]\n                                                [f]\n                                                [f]\n[g]                     [h]\n                        [h]\n                        [h]\n                        [h]\n                        [h]"
,"[a]                     [b][b]                  [c]\n[a]                                             [c]\n[a]                                             [c]\n[a]                                             [c]\n[a]\n[d]                     [e]                     [f]\n[g]                     [h][h][h][h]            [i][i][i]\n[g]                                             [i][i][i]\n[g][g][g][g]\n[j][j]\n[j][j][j][j]"
,"[a]                     [b]                     [c]\n                        [b][b]\n                        [b][b][b]\n[d][d][d]               [e]                     [f][f]\n   [d][d]               [e]                     [f][f]\n      [d]               [e]\n                        [e]\n[g][g]                  [h]                     [i][i][i]\n                        [h]                     [i][i][i]\n                        [h]\n[j][j][j]"
,"[a][a]                  [b][b]                  [c]\n                                                [c]\n                                                [c]\n                                                [c]\n                                                [c][c]\n[d]                     [e]                     [f][f][f]\n                        [e]\n                        [e]\n                        [e][e][e]\n[g][g]                  [h]                     [i]\n                        [h][h][h]               [i]\n                        [h][h]                  [i]\n[j]                     [k]\n                        [k]\n                        [k]\n                        [k]"
,"[a]                     [b]                     [c][c][c][c][c]\n[a]\n[a][a][a][a]\n[d][d]                  [e]                     [f]\n[d][d]\n[g]                     [h][h]                  [i]\n[g]                     [h][h][h]               [i]\n[j]                     [k]\n[j]                     [k]\n[j]                     [k]\n                        [k][k]\n                           [k]"
,"[a]                     [b]                     [c]\n[a][a]                  [b]\n                        [b]\n                        [b][b]\n                           [b]\n[d]                     [e]                     [f][f][f]\n[d]                     [e]                     [f][f][f]\n                        [e]\n[g]                     [h]                     [i]\n                        [h]                     [i]\n                        [h]                     [i][i][i]\n                                                      [i]\n[j][j][j][j][j]"
,"[a]                     [b]                     [c][c]\n                        [b]                     [c][c]\n                        [b]\n                        [b]\n[d][d]                  [e][e][e]               [f][f]\n[d][d]\n[g]                     [h][h]                  [i][i]\n                        [h][h]                  [i][i]\n                        [h][h]\n[j]                     [k]\n                        [k]\n                        [k][k][k]\n                              [k]"
,"[a][a]                  [b][b]                  [c]\n   [a][a]                  [b]                  [c]\n      [a]                  [b]                  [c]\n                           [b]                  [c]\n[d]                     [e]                     [f]\n                                                [f][f]\n                                                [f][f][f]\n[g][g]                  [h][h][h]               [i]\n[j][j]                  [k][k]\n                        [k][k][k][k]"
,"[a]                     [b]                     [c]\n                                                [c]\n                                                [c]\n                                                [c][c]\n                                                   [c]\n[d]                     [e][e]                  [f][f]\n                        [e][e][e]\n                              [e]\n[g]                     [h]                     [i][i][i]\n                        [h]\n                        [h]\n                        [h]\n                        [h]\n[j][j]                  [k]                     [l]\n                        [k]                     [l]\n                                                [l][l]\n                                                   [l][l]"
,"[a][a]                  [b]                     [c]\n   [a]                                          [c][c]\n   [a]                                             [c]\n   [a]                                             [c]\n   [a]                                             [c]\n[d]                     [e]                     [f]\n[d]                                             [f]\n[d][d]                                          [f]\n   [d]                                          [f]\n   [d]\n[g][g][g]               [h][h]                  [i]\n                                                [i]\n                                                [i]\n                                                [i]\n                                                [i][i]\n[j]"
,"[a]                     [b]                     [c][c]\n                        [b]\n                        [b]\n[d]                     [e][e]                  [f]\n[d][d][d]                  [e]                  [f][f]\n[d][d]                                          [f][f][f]\n[g][g][g]               [h][h][h]               [i][i]\n                              [h][h]            [i][i]\n[j]                     [k]\n[j]"
,"[a][a][a]               [b][b]                  [c]\n                           [b]                  [c][c][c]\n                                                [c][c]\n[d]                     [e][e]                  [f][f]\n[d]                                             [f][f]\n[g]                     [h]                     [i][i][i][i]\n[g][g]                  [h]                           [i][i]\n[g][g][g]               [h]\n[j]"
,"[a][a][a]               [b]                     [c]\n                                                [c]\n                                                [c][c]\n                                                [c][c]\n[d]                     [e]                     [f]\n[d][d][d]               [e]                     [f]\n                                                [f][f]\n                                                   [f][f]\n[g]                     [h]                     [i][i]\n[g]                     [h]\n[g]                     [h]\n[j][j][j]\n[j][j]\n   [j]"
,"[a]                     [b]                     [c]\n                        [b]                     [c][c][c][c]\n                        [b]                           [c]\n[d][d]                  [e][e][e]               [f]\n[d][d][d][d]\n[g]                     [h]                     [i][i][i]\n[g]                     [h]\n[g]\n[j][j]                  [k]\n                        [k]\n                        [k][k][k]\n                              [k]"
,"[a]                     [b]                     [c]\n[a]                                             [c]\n[a]                                             [c]\n[a][a]\n   [a]\n[d]                     [e][e]                  [f][f]\n[g][g]                  [h][h][h]               [i]\n[g][g]                                          [i]\n   [g]\n[j]                     [k]                     [l]\n[j]                     [k]                     [l]\n[j][j]                  [k]\n   [j][j]"
,"[a]                     [b]                     [c][c]\n                        [b]                        [c][c]\n                        [b]                        [c][c]\n                        [b]\n                        [b][b]\n[d][d][d][d]            [e]                     [f]\n                        [e][e]\n                        [e][e]\n                           [e]\n[g]                     [h]                     [i]\n                        [h]\n                        [h]\n                        [h]\n[j]                     [k]                     [l][l]\n                                                [l][l]"
,"[a]                     [b][b][b]               [c]\n[a][a]                        [b]               [c]\n[a][a]                        [b]               [c]\n                                                [c][c][c]\n[d][d]                  [e]                     [f]\n                        [e]                     [f][f][f]\n                                                [f][f]\n[g]                     [h][h][h]               [i]\n[g]\n[g]\n[j][j][j]"
,"[a][a]                  [b][b][b]               [c]\n                              [b]               [c]\n[d]                     [e]                     [f][f][f][f]\n[d][d][d][d][d]\n[g]                     [h]                     [i]\n[g]                     [h][h][h]               [i]\n[g][g][g]                     [h][h]            [i]\n      [g]\n[j]                     [k]"
,"[a]                     [b][b][b][b]            [c]\n[a][a][a]                                       [c]\n   [a][a]                                       [c]\n[d]                     [e]                     [f]\n[d]                                             [f]\n[g][g][g]               [h]                     [i][i]\n      [g]                                       [i][i]\n[j]                     [k]\n[j]                     [k]\n[j][j]                  [k]\n   [j]\n   [j]"
,"[a][a][a]               [b]                     [c][c][c]\n   [a][a]               [b]                     [c][c][c]\n      [a]               [b]\n[d]                     [e][e][e][e]            [f]\n[d]\n[d]\n[d][d]\n   [d]\n[g]                     [h]                     [i]\n[g]\n[j]\n[j][j]\n[j][j][j]"
,"[a][a][a]               [b]                     [c]\n                        [b]\n                        [b]\n[d]                     [e]                     [f]\n[d]                     [e]                     [f][f]\n[d]\n[d][d][d]\n[g]                     [h]                     [i][i][i][i]\n[j]                     [k][k]\n[j][j]                     [k][k]\n[j][j][j]                     [k]\n                              [k]"
,"[a][a]                  [b][b][b]               [c]\n[a][a]                                          [c][c]\n                                                [c][c][c]\n[d]                     [e][e]                  [f]\n                                                [f]\n                                                [f]\n                                                [f]\n[g]                     [h]                     [i][i]\n[g][g]                  [h]                        [i]\n                        [h]\n[j][j]                  [k]\n   [j][j]\n      [j]\n      [j]"
,"[a]                     [b]                     [c][c][c][c][c]\n[a]                     [b]\n[a]\n[d][d][d]               [e]                     [f]\n[d][d][d]               [e]                     [f]\n                        [e][e]                  [f]\n                        [e][e]                  [f]\n                                                [f][f]\n[g]                     [h]                     [i][i]\n                                                [i][i]\n                                                [i][i]"
,"[a]                     [b]                     [c]\n[a]                     [b]\n[a]                     [b][b]\n[a]                        [b][b]\n[d][d][d][d]            [e]                     [f][f]\n                                                [f][f]\n[g][g]                  [h]                     [i][i]\n[g][g]                  [h][h][h]               [i][i]\n   [g][g]                                          [i]\n[j]"
,"[a]                     [b][b][b]               [c]\n[a][a][a]                     [b]\n[a][a]                        [b]\n[d][d][d]               [e]                     [f]\n                        [e][e][e]\n                        [e][e]\n[g][g]                  [h]                     [i]\n                        [h]                     [i]\n                        [h]\n[j]                     [k][k]\n[j]                     [k][k]\n[j]"
,"[a][a]                  [b][b][b][b]            [c]\n   [a][a]                                       [c]\n   [a][a]\n[d]                     [e]                     [f]\n[d]\n[d][d]\n   [d]\n   [d]\n[g][g]                  [h]                     [i]\n[g][g]                                          [i]\n[j]                     [k]\n[j]                     [k][k]\n[j]                        [k]\n                           [k]\n                           [k]"
,"[a][a]                  [b]                     [c]\n                        [b]                     [c]\n                        [b]\n[d][d][d]               [e]                     [f]\n[d][d][d]               [e]                     [f][f]\n                        [e]                     [f][f][f]\n[g]                     [h]                     [i]\n                        [h]                     [i]\n                                                [i][i]\n                                                   [i]\n                                                   [i]\n[j]                     [k]                     [l][l][l]"
,"[a]                     [b]                     [c]\n                                                [c]\n                                                [c]\n[d]                     [e][e][e]               [f]\n                                                [f]\n                                                [f]\n                                                [f][f][f]\n[g]                     [h][h][h][h]            [i]\n[g]                                             [i][i]\n                                                [i][i][i]\n[j][j]                  [k][k]\n[j][j]                     [k][k]\n                              [k]"
,"[a][a][a]               [b]                     [c]\n                        [b][b][b][b]            [c]\n                                 [b]            [c]\n[d]                     [e][e][e]               [f][f]\n[d]                     [e][e][e]\n[d][d][d][d]\n[g][g]                  [h]                     [i]\n[g][g]                  [h]\n[j][j][j]"
,"[a]                     [b][b][b]               [c]\n[a]                           [b]               [c]\n[a]                                             [c][c][c]\n                                                      [c]\n[d][d]                  [e][e][e][e]            [f]\n[d][d]\n[g]                     [h]                     [i]\n                        [h][h][h]               [i]\n                              [h][h]\n[j]                     [k][k]\n                        [k][k]"
,"[a][a][a]               [b]                     [c][c][c]\n                                                      [c]\n[d]                     [e]                     [f]\n[d]                                             [f][f][f]\n[d]                                             [f][f]\n[g]                     [h][h]                  [i]\n                        [h][h]                  [i]\n                                                [i]\n[j]                     [k]                     [l][l]\n[j]                     [k][k][k]\n                        [k][k]"
,"[a]                     [b]                     [c]\n[a]                     [b][b]\n[a]                     [b][b][b]\n[a]\n[d]                     [e]                     [f][f][f]\n[d][d]                  [e]                        [f][f]\n[d][d]                  [e]\n   [d]                  [e]\n[g][g]                  [h]                     [i]\n[j]                     [k][k][k]\n[j][j]"
,"[a][a][a][a][a]         [b]                     [c][c]\n                                                [c][c]\n[d][d][d]               [e]                     [f][f]\n[d][d][d]                                          [f]\n                                                   [f]\n[g]                     [h][h]                  [i]\n[g]                     [h][h][h]               [i]\n[g][g][g][g]                                    [i]\n                                                [i]"
,"[a][a]                  [b]                     [c][c][c]\n                        [b]\n                        [b]\n                        [b][b]\n                           [b]\n[d]                     [e][e]                  [f]\n[d]\n[d]\n[d]\n[g][g]                  [h]                     [i]\n   [g]                                          [i]\n   [g]                                          [i][i]\n                                                   [i]\n                                                   [i]\n[j]                     [k]\n                        [k][k]\n                           [k]\n                           [k][k]"
,"[a][a]                  [b]                     [c][c]\n[a][a][a]               [b][b]\n      [a]\n[d]                     [e]                     [f]\n[d]                     [e]                     [f]\n[d][d][d]               [e]\n   [d]\n[g]                     [h][h][h]               [i][i][i]\n                                                [i][i][i]\n[j][j]\n   [j]\n   [j]"
,"[a][a][a][a]            [b]                     [c]\n                                                [c][c]\n                                                [c][c][c]\n[d][d][d]               [e][e][e]               [f]\n                           [e][e]               [f]\n                                                [f]\n[g]                     [h]                     [i]\n[g]                     [h]                     [i]\n                        [h]                     [i]\n                        [h]                     [i][i][i]\n                        [h]\n[j]"
,"[a]                     [b]                     [c][c][c]\n[a]                     [b]\n[a][a]                  [b][b]\n                        [b][b]\n[d][d]                  [e]                     [f]\n   [d][d]               [e][e]\n      [d]                  [e]\n      [d]                  [e]\n                           [e]\n[g][g]                  [h]                     [i]\n                        [h]\n                        [h]\n                        [h]\n                        [h]\n[j][j]"
,"[a]                     [b][b][b][b]            [c]\n[a]\n[a][a][a][a]\n[d]                     [e]                     [f]\n[d]                     [e]                     [f]\n                        [e]                     [f]\n[g][g][g]               [h][h][h]               [i][i]\n[g][g][g]               [h][h][h]               [i][i]\n[j]"
,"[a]                     [b][b][b][b]            [c]\n[a][a]                        [b][b]\n[a][a][a]\n[d]                     [e][e]                  [f][f]\n[d]                     [e][e]                     [f]\n[d]\n[d]\n[g][g][g]               [h]                     [i]\n                        [h][h][h]\n                        [h][h]\n[j][j]"
,"[a][a]                  [b]                     [c][c][c][c][c]\n[a][a][a]\n[d][d][d]               [e]                     [f][f]\n      [d]\n      [d]\n[g]                     [h]                     [i]\n[g][g][g]               [h]                     [i]\n   [g][g]                                       [i]\n[j]\n[j]\n[j][j]\n[j][j]"
,"[a][a][a]               [b]                     [c]\n                        [b][b][b]               [c]\n                        [b][b]                  [c]\n                                                [c]\n                                                [c]\n[d][d]                  [e]                     [f][f]\n                                                [f][f]\n[g][g][g]               [h]                     [i]\n      [g]                                       [i][i]\n      [g][g]                                    [i][i][i]\n[j]\n[j]"
,"[a]                     [b][b]                  [c]\n[d]                     [e]                     [f]\n[d]\n[g][g]                  [h][h]                  [i]\n[g][g][g]                                       [i]\n      [g]                                       [i][i]\n                                                   [i][i]\n[j][j][j]               [k]                     [l]\n                        [k]                     [l]\n                        [k]                     [l]\n                                                [l][l]\n                                                   [l]\n[m]\n[m]"
,"[a]                     [b]                     [c]\n                        [b]                     [c]\n                        [b][b]\n                           [b][b]\n[d][d][d][d][d]         [e]                     [f][f][f]\n                                                [f][f][f]\n[g]                     [h]                     [i][i]\n[g]                     [h][h]                     [i][i]\n[g]                                                [i][i]\n[j]\n[j]\n[j]"
,"[a]                     [b][b][b]               [c]\n[a][a]                        [b]               [c]\n[a][a][a]                     [b][b]            [c]\n[d][d]                  [e]                     [f]\n                                                [f][f][f]\n                                                [f][f]\n[g][g][g]               [h]                     [i]\n                        [h]                     [i]\n[j][j]                  [k]\n[j][j]"
,"[a][a][a]               [b][b][b]               [c]\n      [a]               [b][b][b]               [c]\n      [a]\n[d]                     [e]                     [f]\n[d]                     [e][e][e]               [f]\n[d]                        [e][e]\n[g]                     [h]                     [i][i][i]\n[g]\n[g][g]\n   [g]\n   [g]\n[j][j]"
,"[a]                     [b]                     [c][c][c][c]\n[a][a]                  [b]\n   [a]                  [b]\n   [a][a]\n[d]                     [e]                     [f]\n                        [e]\n                        [e][e]\n                           [e]\n                           [e]\n[g][g]                  [h]                     [i]\n                        [h]                     [i]\n[j]                     [k]                     [l][l]\n                        [k]                        [l][l]\n                                                   [l][l]"
,"[a]                     [b]                     [c]\n[d]                     [e]                     [f]\n[d][d]                  [e]                     [f]\n   [d][d]               [e][e]                  [f]\n      [d]                  [e][e]\n[g]                     [h]                     [i][i][i][i]\n[g]                     [h]\n[j][j][j]               [k]\n   [j][j]               [k][k][k]\n      [j]"
,"[a]                     [b]                     [c]\n[a]\n[a]\n[a]\n[d]                     [e][e][e][e]            [f][f]\n                                                [f][f]\n[g][g][g]               [h]                     [i][i][i]\n                        [h]                     [i][i][i]\n                        [h][h][h][h]\n[j]\n[j]\n[j]\n[j][j][j]"
,"[a][a]                  [b]                     [c]\n[a][a]\n[d][d][d][d][d]         [e]                     [f]\n                        [e][e][e]               [f]\n                              [e][e]            [f]\n                                                [f]\n                                                [f]\n[g]                     [h]                     [i]\n[g]                     [h][h]\n[g][g]\n   [g][g]\n[j][j][j]\n      [j]"
,"[a]                     [b][b][b]               [c]\n[a]                           [b]               [c]\n[a][a][a]                     [b]               [c]\n                              [b]\n[d]                     [e][e]                  [f][f]\n                                                [f][f]\n[g]                     [h]                     [i]\n[g]                     [h][h][h]               [i]\n                        [h][h]                  [i]\n[j]                     [k][k][k]"
,"[a]                     [b]                     [c]\n                        [b]                     [c]\n                        [b][b]\n                        [b][b]\n[d]                     [e]                     [f]\n[d]                     [e]\n[d]                     [e]\n[d]\n[d][d]\n[g]                     [h]                     [i][i]\n[g][g]                  [h][h]                     [i]\n                           [h][h]\n                              [h]\n[j]                     [k][k][k][k]"
,"[a][a]                  [b]                     [c][c][c][c][c]\n                        [b]\n                        [b]\n[d]                     [e]                     [f][f][f]\n                        [e]                     [f][f][f]\n[g]                     [h][h]                  [i]\n                           [h]                  [i]\n                           [h]                  [i][i]\n                                                   [i][i]\n[j]\n[j]\n[j]\n[j]\n[j][j]"
,"[a][a][a]               [b][b]                  [c][c]\n                        [b][b]\n[d]                     [e]                     [f][f]\n[d]                     [e]                     [f][f]\n[d]\n[g]                     [h]                     [i]\n                        [h]                     [i][i]\n                        [h]                     [i][i][i]\n                        [h]\n                        [h]\n[j][j][j]\n   [j][j]\n      [j]"
,"[a][a]                  [b][b]                  [c]\n[a][a]                                          [c][c]\n[a][a]                                             [c]\n                                                   [c]\n                                                   [c]\n[d]                     [e][e][e]               [f]\n                                                [f]\n                                                [f]\n[g]                     [h][h][h]               [i]\n[g]                        [h][h]               [i]\n[j]\n[j]\n[j][j]\n   [j]\n   [j]"
,"[a][a]                  [b]                     [c]\n[a][a]                  [b]                     [c]\n                        [b][b][b]               [c]\n                              [b]               [c][c][c]\n[d]                     [e]                     [f][f]\n[d]\n[g][g][g]               [h][h][h]               [i]\n                                                [i]\n                                                [i]\n[j]\n[j]\n[j]\n[j]\n[j][j]"
]

to=0
function update() {
  var nt=+I.value
  var test = Test[nt-1]
  if (test) {
    O.textContent = test
    clearTimeout(to)
    to = setTimeout(_=>{
      I.disabled = true
      var t = + new Date()
      var [d,r]=F(test)
      O.textContent = 'Time '+(new Date-t)/1000+' sec'+d+r.join`\n`+'\n'+test
      I.disabled = false
    }, 800)
  }
}

update()
Test # <input id=I value=1 type=number oninput='update()' max=101 min=1> (1 to 101, be patient: some testcase is slow to solve)
<pre id=O></pre>


Hay otros casos de prueba vinculados al texto CASOS DE PRUEBA.
Jonathan Picazo

1
@JonathanMicaelPicazo agregado
edc65
Al usar nuestro sitio, usted reconoce que ha leído y comprende nuestra Política de Cookies y Política de Privacidad.
Licensed under cc by-sa 3.0 with attribution required.