improved surrounded region problem. Time limit still exceeded