#include #include #include #include #include #include #define XLEN 139 //10 #define YLEN 137 //9 #define LEN (XLEN * YLEN) typedef struct Sea_cuc_move { int from_pos; int to_pos; } Sea_cuc_move; char map[LEN]; char map_bak[LEN]; void ParseInput(char *input) { for(int i=0; i') { int x = i % XLEN; if(x == (XLEN-1)) { if(map[i - x] != '.') continue; positions_east[cucs_east] = (Sea_cuc_move){i, i - x}; cucs_east += 1; } else if(map[i+1] == '.') { positions_east[cucs_east] = (Sea_cuc_move){i, i + 1}; cucs_east += 1; } } } assert(cucs_east < 5000); if(cucs_east != 0) for(int i=0; i', positions_east[i]); } void MoveSouth() { Sea_cuc_move positions_south[5000]; int cucs_south = 0; for(int i=0; i