2025 年 E108.D 巻 3 号 p. 186-191
A floorplan is a partition of an axis-aligned rectangle into a set of smaller rectangles. Given an integer e we regard a floorplan is desirable for its safety if each room has an escape route to a room facing the outside, where the route passes through at most e walls, and simple, which is, directs to only either (1) south or east, (2) east or north, (3) north or west or (4) west or south. In this paper we design an algorithm to generate all floorplans with exactly n rooms and satisfying the property above. Our algorithm generates all such floorplans in O(n2) time for each.