The Happy Worm Time Limit: 5000MS Memory Limit: 131072K Total Submissions: 4698 Accepted: 1047 Description The Happy Worm lives in an m*n rectangular field. There are k stones placed in certain locations of the field. (Each square of the field is eit…
#include<cstdio> #include<cstring> using namespace std; bool map[505][505]; int n, k; bool vis[505]; int linker[505]; void sscanf() { int x, y; scanf("%d%d",&n,&k); for(int i=1;i<=k;i++) { scanf("%d%d",&x,&am…
Description There is a rectangular room, covered with square tiles. Each tile is colored either red or black. A man is standing on a black tile. From a tile, he can move to one of four adjacent tiles. But he can't move on red tiles, he can move only…