#futurecontest2022quala. [future_contest_2022_qual_a]Project Leader
[future_contest_2022_qual_a]Project Leader
Story
You have been hired as a project leader of F Corporation. Your job is to assign tasks to team members appropriately. The current project consists of a number of tasks. The expected number of days for a team member to complete a task depends on skill levels of the team member and required skill levels for the task. You are highly experienced and can accurately estimate the required skill levels for each task, but since you have just joined the team, you do not yet know the skill levels of each team member at all. Please assign tasks appropriately while gradually evaluating the skill levels of team members.
Problem Statement
You want to assign tasks to team members. You can assign each task to at most one team member, and once you assign a task to a team member, you cannot assign another task to him/her until he/she completes the task. There are types of skills. Each team member has a non-negative integer vector representing skill levels, and each task has a non-negative integer vector representing required skill levels. Among these, the skill levels are not given as input.
We define . Then, it takes days for team member to complete task , where is defined as follows.
- If , .
- If , , where is a uniform random integer between and , inclusive.
When a task taking days is started on day , the task will be completed at the end of day . There are dependencies between tasks, and before starting a task, all of its dependent tasks must have been completed by the end of the previous day. Please complete all tasks in as few days as possible.
Input and Output
For the range of each input value, see Input Generation.
At the start of the execution, the number of tasks , the number of team members , the number of skills , the number of dependencies , required skill levels for each task , and a list of pairs of dependent tasks are given from Standard Input in the following format.
indicates that the task () depends on the task () and that must be completed before starting . It satisfies , and the same pair appears at most once in the input.
Then, starting from day 1, do the following two processes every day.
First, output to Standard Output a list of pairs such that team member () starts task () on that day in one line in the following format.
After the output, you have to flush Standard Output. Otherwise, the submission might be judged as TLE