#K60887. Employee Bonus Eligibility

    ID: 31186 Type: Default 1000ms 256MiB

Employee Bonus Eligibility

Employee Bonus Eligibility

You are given a record of employees' project completions over several months. Based on this record, you must answer queries regarding their eligibility for a bonus. An employee is eligible for a bonus if the total number of projects completed by that employee up to a given month is at least a threshold \(T\), i.e. \(\sum_{j=1}^{k} P_{i,j} \geq T\), where \(P_{i,j}\) indicates whether employee \(i\) completed the project in month \(j\) and \(k\) is the month specified in the query.

There are two types of queries:

  • Type 1: Query the bonus eligibility. The query is given as "1 i k" where \(i\) is the employee number and \(k\) is the month. Print ELIGIBLE if the total projects completed by the employee up to month \(k\) are at least \(T\); otherwise print NOT ELIGIBLE.
  • Type 2: Update the project record. The query is given as "2 i s" where \(i\) is the employee number and \(s\) is the new status for the last month (i.e. the \(M^{th}\) month). This updates the employee's record immediately.

The queries are processed in order. Note that only queries of type 1 produce output.

inputFormat

The input is read from stdin and has the following format:

E M T
P[1,1] P[1,2] ... P[1,M]
P[2,1] P[2,2] ... P[2,M]
... 
P[E,1] P[E,2] ... P[E,M]
Q
query1
query2
...
queryQ

where:

  • E is the number of employees.
  • M is the number of months.
  • T is the bonus threshold.
  • Each of the next E lines contains M integers (each 0 or 1) representing the project completion status for an employee.
  • Q is the number of queries.
  • Each query is either of the form "1 i k" (to check bonus eligibility for employee i up to month k) or "2 i s" (to update employee i's record for the last month to s).

outputFormat

For each query of type 1, print a single line to stdout with the result: either ELIGIBLE or NOT ELIGIBLE.

## sample
3 5 3
1 0 1 1 0
0 1 1 0 0
1 1 0 1 1
4
1 1 4
2 2 1
1 2 3
1 3 5
ELIGIBLE

NOT ELIGIBLE ELIGIBLE

</p>