1 // PORFAVOR NUNCA BORRAR ESTE PROBLEMA::: COSTO UN OJO DE LA CARA....
21 #define forn(i, n) for(int i=0;i<int(n);i++)
22 #define foreach(it, c) for(typeof((c).begin()) it = (c).begin();it!=(c).end();++it)
23 #define ALL(x) (x).begin(),(x).end()
24 #define SORT(x) sort(ALL(x))
26 #define VI vector<int>
27 #define VS vector<string>
30 short pre
[365597][14];
38 if(arr
[i
][k
]=='*')return 0;
42 void bick(int paso
, int columna
, int subida
, int bajadas
){
44 forn(i
, 14) pre
[cant
][i
] = ar
[i
];
48 for(int i
= 0, b
= 1; i
< N
; i
++, b
<<= 1){
49 if(!(columna
&b
) && !(subida
&(1<<(paso
+i
))) && !(bajadas
&(1<<(paso
-i
+N
-1)))&&!(table
[paso
]&b
)){
51 bick(paso
+1, columna
^b
, subida
^(1<<(paso
+i
)),bajadas
^(1<<(paso
-i
+N
-1)));
56 void back(int paso
, int columna
, int subida
, int bajadas
){
59 for(int i
= 0, b
= 1; i
< N
; i
++, b
<<= 1){
60 if(!(columna
&b
) && !(subida
&(1<<(paso
+i
))) && !(bajadas
&(1<<(paso
-i
+N
-1)))&&!(table
[paso
]&b
))
66 for(int i
= 0, b
= 1; i
< N
; i
++, b
<<= 1)
68 back(paso
+1, columna
^b
, subida
^(1<<(paso
+i
)),bajadas
^(1<<(paso
-i
+N
-1)));
71 int tmp
= columna
& (subida
/(1<<paso
)) & (bajadas
/(1<<//& table[paso];
74 back(paso
+1, columna
^b
, subida
^(1<<(paso
+M
[b
])),bajadas
^(1<<(paso
-M
[b
]+N
-1)));
79 for(int i
=0;i
<15;i
++) M
[1<<i
] = i
;
84 int ans
[]={0,0, 0, 0, 2, 10, 4, 40, 92, 352, 724, 2680, 14200, 73712, 365596, 2279184 };
86 //printf("%i cant\n", cant);
91 for(i
=0;i
<N
;i
++)table
[i
]=0;
95 for(j
=0, b
= 1;j
<N
;j
++, b
<<=1){
96 if(arr
[i
][j
]=='*'){table
[i
]^=b
;k
++;}
110 // else res = ans[N];
112 printf("Case %i: %i\n",casos
, res
);