Graph by nn

short z[][12];t,n,x;main(i,p){for(;i<n?gets(z+i++):++t<n?f(x=0,p,n)|printf("%d\n"+6+~t/n*6,x):~scanf("%d%d ",&p,&n,t=i=0););}f(s,p,i){for(p|s-t||x++;i--;)z[s][i]&!!p&&f(i,p-1,n);}

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

download

return to the top page