/* * Sample solution to the Keys problem. * Central Europe Regional Contest 2007. * * Jan Cibulka, 2007 */ #include #include #include #define MAXSIZE 100 int r,c; int vis[MAXSIZE*MAXSIZE*18]; int q[MAXSIZE*MAXSIZE*18], qsteps[MAXSIZE*MAXSIZE*18]; int type[MAXSIZE*MAXSIZE]; int qb,qe; int finished; void go_try(int i, int j, int k, int s) { int pos, tmp; pos = i*c+j; if(type[pos]==1) { finished=1; return; } if(type[pos]==-1) return; if(type[pos]>=10 && type[pos]<20) { tmp = type[pos]-10; if(((1<0 && c>0 && r<=100 && c<=100); tmp = -1; for(i=0;i=20 && type[pos]<30) keys|=(1<<(type[pos]-20)); if(posr>0) go_try(posr-1,posc,keys,steps); if(posr0) go_try(posr,posc-1,keys,steps); if(posc