#P12296. [ICPC 2023 WF] Schedule
[ICPC 2023 WF] Schedule
题目描述
The Institute for Creative Product Combinations (ICPC) tries to find unusual and innovative ways to unite seemingly unrelated products or technologies, opening up new markets and creating new jobs. (For instance, their most recent success was the "hairbachi," a hair-dryer with a hibachi grill top attachment for preparing on-the-go hot meals.) The company employs teams of size to research individual products, then members of the different teams get together to explore ways of combining products.
During the pandemic, the ICPC management organized everyone's schedule in such a way that there were never more than people in the office at the same time, and things ran so smoothly that they continued the process once things began to return to normal. Here is the scheme they used. Label the teams with integers through and the two people on the team as and for each from to . Each week, exactly one person from each team is allowed in the office, while the other has to stay away. The employees and know each other well and collaborate productively regardless of being isolated from each other, so members of the same team do not need to meet in person in the office. However, isolation between members from different teams is still a concern.
Each pair of teams and for has to collaborate occasionally. For a given number of weeks and for fixed team members and , let be the weeks in which these two team members meet in the office. The isolation of those two people is the maximum of
$$\{w_1,w_2-w_1,w_3-w_2,\ldots,w_k-w_{k-1},w+1-w_k\} $$or infinity if those two people never meet. The isolation of the whole company is the maximum isolation across all choices of , , , and .
You have been tasked to find a weekly schedule that minimizes the isolation of the whole company over a given number of weeks.
输入格式
The input consists of a single line containing two integers () and (), where is the number of teams and is the number of weeks that need to be scheduled.
输出格式
Output a line containing either an integer representing the minimum isolation achievable for teams or the word infinity
if no schedule guarantees that every pair of individuals on different teams can meet. If the isolation is finite, it is followed by lines representing a schedule that achieves this isolation. The line of the schedule is a string of length containing only the symbols 1
and 2
, where the symbol indicates which of the two members from team comes into the office on week .
2 6
4
11
12
21
22
11
12
2 1
infinity