1605 {
1606 if(x == 0 || y == 0 || x ==
n - 1 || y ==
m - 1) {
1607 unsigned int count = 0;
1608 int current_x = x;
1609 int current_y = y;
1611 auto path = unordered_set<step, step_hash, step_equal>();
1612 while(0 <= current_x && current_x <
n && 0 <= current_y && current_y <
m) {
1613 auto s = step(current_d, current_x, current_y);
1614 if(!path.contains(s)) {
1615 path.insert(s);
1616 } else {
1617 return -1;
1618 }
1619
1621 if((*record)[x][y] != 0) {
1622 return count + (*record)[x][y];
1623 }
1625 count++;
1626 (*
get_record(!current_d))[current_x][current_y] = count;
1627 switch(current_d) {
1629 current_y--;
1630 break;
1631 }
1633 current_y++;
1634 break;
1635 }
1637 current_x--;
1638 break;
1639 }
1641 current_x++;
1642 break;
1643 }
1644 }
1645 }
1646 return count;
1647 }
1648 return -1;
1649 }
direction reflect(direction d, char mirror)
方向经过镜子反射后的变化
char mirrors[1000][1000]
镜子
unsigned(* get_record(direction d))[1000]
获取记录类型