#B2608. Evaluation Queue Machine Problem

    ID: 11247 Type: Default 1000ms 256MiB

Evaluation Queue Machine Problem

Evaluation Queue Machine Problem

The LG Judge system handles submission evaluation tasks whose workload increases uniformly over time. In particular, consider the following two scenarios:

  • With \(8\) machines, the entire evaluation queue is processed in \(30\) minutes.
  • With \(10\) machines, the entire evaluation queue is processed in \(6\) minutes.

Assume that at time 0 there is an initial backlog of \(X\) tasks and tasks are added at a constant rate \(R\) (tasks per minute). The machines work in parallel and each machine processes one task per minute. Hence, if \(M\) machines are used and it takes \(T\) minutes to clear the queue, we have:

[ M \times T = X + R \times T ]

Using the two scenarios, we get:

[ 8 \times 30 = (8 - R) \times 30 = X \quad \text{and} \quad 10 \times 6 = (10 - R) \times 6 = X ]

Equate the two expressions for \(X\):

[ (8 - R) \times 30 = (10 - R) \times 6 ]

Solve for \(R\):

[ 240 - 30R = 60 - 6R \quad \Longrightarrow \quad 180 = 24R \quad \Longrightarrow \quad R = 7.5 ]

Then, \(X = (8 - 7.5) \times 30 = 15\).

Now, determine the number of machines \(M\) needed such that the evaluation finishes exactly in \(10\) minutes:

[ M \times 10 = 15 + 7.5 \times 10 = 15 + 75 = 90 \quad \Longrightarrow \quad M = 9 ]

Output the integer \(9\), which is the required number of machines.

inputFormat

This problem does not require any input.

outputFormat

Output a single integer representing the number of machines that would finish processing the evaluation queue in exactly 10 minutes.

sample

9