Top Salesperson
Time limit1.5sMemory limit1024 MB
Given each employee's initial sales at their assigned stores, print after each sales record how many employees lead every store they are in charge of.
- Level
Medium5 of 10
- Topics
- Array, Implementation, Simulation
- Solved
- No attempts yet
Problem
ZerOne Inc. president Jeongmin decides to choose a top salesperson to put some pressure on employees who have gotten complacent. Each employee is in charge of of the stores in total. The top salesperson is the employee who holds the first place in cumulative sales at every store they are in charge of. At each store, the cumulative sales amounts of the employees are always distinct and never decrease.
The sales records made by ZerOne employees are given in chronological order. After each record, compute the cumulative sales amounts and find the number of top salespeople.
Input
The first line contains the number of employees , the total number of stores , and the number of stores each employee is in charge of, separated by spaces. (, , )
From the second line, each employee's store number and initial sales amount are given times per line, separated by spaces. The data is given in order from employee 1 to employee . (, )
The -th line contains the number of sales records . ()
From the -th line, lines follow in chronological order. Each line contains the employee number , the store number , and the amount added to the cumulative sales at that store, separated by spaces. (, , )
All numbers in the input are integers.
Output
After each sales record, print the current number of top salespeople on its own line, for a total of lines.