#K56127. Minimum Rounds for Task Processing

    ID: 30130 Type: Default 1000ms 256MiB

Minimum Rounds for Task Processing

Minimum Rounds for Task Processing

You are given N tasks with their individual processing times, and there are S servers available to process these tasks. Each server can process at most M tasks in one round. However, a server can only process a task if the task's processing time is at most T. The processing capacity per round in total is therefore given by the product \(S \times M\). Your goal is to determine the minimum number of rounds required to process all tasks that satisfy the processing time constraint.

If no task can be processed (i.e. all tasks have a processing time greater than \(T\)), then the answer is 0.

Note: The number of rounds required is computed using the ceiling function: \[ \text{rounds} = \left\lceil \frac{\text{number of valid tasks}}{S \times M} \right\rceil \]

inputFormat

The input is given via standard input and consists of two lines:

  • The first line contains four integers: N (the number of tasks), S (the number of servers), M (the maximum number of tasks each server can process in one round), and T (the maximum processing time a server can handle for a task).
  • The second line contains N space-separated integers representing the processing times of the tasks.

outputFormat

Output via standard output a single integer representing the minimum number of rounds required to process all valid tasks. If no task can be processed, output 0.

## sample
7 2 3 50
10 20 10 50 30 20 40
2