Find the Hyper Spot to Lie Down In
Time limit4sMemory limit1024 MB
Given an 11-dimensional N-cube with K obstacle cells, count the runs of at least two empty cells along each of the 11 axes.
- Level
Medium6 of 10
- Topics
- Hash map, Sorting, Implementation
- Solved
- No attempts yet
Problem
Shift spent a year traveling the world in VR inside the metaverse. Tired from the trip, Shift booked a room for one night at a nearby Virtual Condo.
The rooms in the Virtual Condo form an -dimensional hypercube of cells. Each cell is a unit cube of size , parallel to the , , , , , , , , , , and axes. Each cell is identified by coordinates with .
The room is full of cargo that cannot be moved. Each cargo item is a single unit cell, and the cargo takes up space Shift could use to lie down. Shift has to find a place to lie down in this poor environment.
A place to lie down needs 2 or more empty cells in a row in a straight line. Shift can stretch out along that line. Shift can lie down in any of eleven directions, each parallel to one of the eleven axes. Shift always stretches fully, so the body always touches a wall or a cargo item. Shift never lies down halfway.

In the room shown in the picture above, there are places to lie down along the axis, along the axis, along the axis, along the axis, along the axis, along the axis, along the axis, along the axis, along the axis, along the axis, and along the axis.
Given the room size and the layout of the room, write a program that counts the places to lie down along each of the eleven axes.
Input
The first line contains the room size and the number of obstacles ().
The next lines give the coordinates of the obstacles in the order , , , , , , , , , , . No two or more obstacles occupy the same position.
Output
On the first line, print the number of places to lie down along the axis.
On the second line, print the number of places to lie down along the axis.
On the third line, print the number of places to lie down along the axis.
On the fourth line, print the number of places to lie down along the axis.
On the fifth line, print the number of places to lie down along the axis.
On the sixth line, print the number of places to lie down along the axis.
On the seventh line, print the number of places to lie down along the axis.
On the eighth line, print the number of places to lie down along the axis.
On the ninth line, print the number of places to lie down along the axis.
On the tenth line, print the number of places to lie down along the axis.
On the eleventh line, print the number of places to lie down along the axis.