#K8001. Team Task Assignment Simulation
Team Task Assignment Simulation
Team Task Assignment Simulation
You are given n team members and m tasks, along with q queries describing operations to be performed. Each team member has a skill level and each task has a minimum required skill. A team member is eligible for a task if their skill is at least the task's requirement (i.e. if \(skill \ge taskRequirement\)).
The queries can be of three types:
- ASSIGN x: Find an available team member whose skill is at least the requirement for task x and has the minimum possible skill among those eligible. If found, assign task x to that team member.
- COMPLETE x: Mark task x as complete, freeing the assigned team member.
- STATUS: Output the current assignment of each team member in the format
member_number: task_number
. If a member is unassigned, printNONE
instead of the task number.
Process the queries sequentially and whenever a STATUS
query is encountered, output the status of all team members.
inputFormat
The input is read from stdin and has the following structure:
- The first line contains three integers n, m, and q representing the number of team members, tasks, and queries, respectively.
- The second line contains n space-separated integers representing the skill levels of the team members.
- The third line contains m space-separated integers representing the minimum skill required for each task. If m is 0, this line will be empty.
- The next q lines each contain a query in one of the following formats:
ASSIGN x
,COMPLETE x
, orSTATUS
.
outputFormat
For each STATUS
query encountered, output n lines where the i-th line is of the format i: task_number
. If the team member is not assigned any task, output NONE
in place of the task number. The output is written to stdout.
3 2 5
20 35 15
10 30
ASSIGN 1
ASSIGN 2
STATUS
COMPLETE 1
STATUS
1: NONE
2: 2
3: 1
1: NONE
2: 2
3: NONE
</p>