#K41752. Taco Table Seating Simulation
Taco Table Seating Simulation
Taco Table Seating Simulation
This problem simulates the seating process in a cafe where tables are numbered from 1 to N. Each customer arriving chooses a table such that the distance to the nearest already occupied table is maximized. In case of ties, the table with the smaller number is chosen. The distance between two tables is defined as the absolute difference of their numbers.
Formally, let \( N \) be the total number of tables and \( C \) be the number of customers. For every customer arriving sequentially, the chosen table \( t \) is determined by:
[ \text{choose } t = \arg\max_{i \notin \text{occupied}} \min_{j \in \text{occupied}} |i-j| ]
with the initial customer always taking table 1 (since when no table is occupied, all available tables have an infinite distance to an occupied table, and the smallest table number is chosen by default).
Your task is to simulate this seating process and produce the list of table numbers in the order they are occupied.
inputFormat
The first line of input contains two integers \( N \) and \( C \) representing the number of tables and number of customers respectively.
\(1 \leq C \leq N\)
outputFormat
Print the sequence of table numbers chosen by the customers in order of their arrival. The numbers should be separated by a single space.
## sample5 3
1 5 3
</p>