#K14846. Takahashi's Seat Selection
Takahashi's Seat Selection
Takahashi's Seat Selection
In this problem, you are given two integers (n) and (m), representing the number of rows and the number of seats per row in a theater. Takahashi selects his seats according to the following rules:
- He always chooses the first row (row index 0) completely.
- After that, he selects every alternate row (i.e. rows with indices 0, 2, 4, ...).
- For the first row (row 0), all seats are chosen. For every subsequent selected row (which will have an even index), only the seats with even indices are chosen.
For example, consider the case where (n = 4) and (m = 4). Takahashi will choose all seats in row 0, and in row 2 he will choose seats with indices 0 and 2. Thus, the answer is: [ [(0, [0, 1, 2, 3]), (2, [0, 2])] ]
Your task is to implement the seat selection algorithm and output the result in the specified format.
inputFormat
The input consists of a single line containing two integers (n) and (m) separated by a space, where (n) is the number of rows and (m) is the number of seats per row.
outputFormat
Output the list of selected seats in the format: [(row_index, [seat_index1, seat_index2, ...]), ...]. Ensure that there are no extra spaces or characters in the output.## sample
4 4
[(0, [0, 1, 2, 3]), (2, [0, 2])]