#K10571. Employee Workload Updater
Employee Workload Updater
Employee Workload Updater
You are given a list of employees along with their current workload and a series of update operations. The first part of the input contains an integer \(N\) representing the number of employees, followed by \(N\) lines with each employee's name and workload. The second part of the input begins with an integer \(M\) representing the number of update operations, followed by \(M\) lines of updates.
An update operation is in one of the following two formats:
- Name amount
: Subtracts the given amount from the employee's workload if the employee exists. Print the message "Name is working diligently." after the update.+ Name amount
: Inserts or updates the employee with the given workload. Print the message "Name is now contributing." after the update.
Your task is to implement the update process and print the resulting messages in the order they are processed.
inputFormat
The input is provided via standard input (stdin) and is structured as follows:
N employee1_name employee1_workload employee2_name employee2_workload ... employeeN_name employeeN_workload M update1 update2 ... updateM
Here, N
is the number of employees and M
is the number of update operations.
outputFormat
For each update operation, output a single line message according to the rules specified. The output should be sent to standard output (stdout).
## sample6
Landon 5
Bateman 9
Cardoni 2
Ellison 7
Alford 1
Ponder 3
2
- Ellison 4
+ Truong 6
Ellison is working diligently.
Truong is now contributing.
</p>