|
|||
ECN BusesFor the first edition of the Sapientia ECN contest, continuous bus transport was organized from the train station (A) to Sapientia University (B) and back. The bus line from A to B is divided into N unit-distance (uD) parts (so the total length of the route is N*uD). Any given bus travels a unit distance in a unit time (uT). Departure times from the train station (A) are at times 0*uT, a*uT, 2*a*uT, … (over the years the bus traffic between the train station and Sapientia University has become a permanent and continuous arrangement, so buses will depart continuously at moments multiple of a*uT). When a bus arrives to the University (B), it will wait till the closest time spot which is an integer multiple of a*uT and then it returns to the train station (A). Along the route A>>B there are stops at positions 0*uD, x1*uD, x2*uD, …, xn*uD, N*uD, and on the way back, B>>A, at positions N*uD, yn*uD, yn – 1*uD, …, y1*uD, 0*uD of the bus line. At every stop, the bus waits b*uT time. Which are those uD multiple points (i*uD, i ∈ {0, 1, …, N}) and uD length open intervals ((i*uD, (i + 1)*uD), i ∈ {0, 1, …, N – 1}) of the bus line, where two buses will meet? Only the meeting point indexes ([i], i ∈ {0, 1, …, N}) and the endpoints indexes of the meeting intervals ((i, (i + 1)), i ∈ {0, 1, …, N – 1}) have to be printed. Which are those segments of the type [i*uD, (i + 1)*uD), i ∈ {0, 1, …, N – 1} of the bus line, where two buses will meet? Input Specification
The first line of the input contains the number of test cases. The input format of each test case is the following: Output SpecificationPrint consecutive lines the uT multiple meeting points indexes (in square brackets) and meeting intervals endpoint indexes (in brackets, separated with comma) (sorted in ascending order) followed by the number of meetings. Restrictions
Sample Input
Output for Sample Input
|
|||
University of Debrecen; Faculty of Informatics; v. 09/30/2024 |