0% found this document useful (0 votes)
41 views1 page

Problem E. Approve or Reject: 1000 Ms Linux

The problem describes a manufacturing project with K tasks that must be completed within X days. Teams of workers are assigned to each task, with a team of A workers completing their task in A days. If a team's work is rejected, they resubmit on subsequent A, 2A, 3A days until approved. The goal is to find the minimum number of total workers needed across all teams to finish within X days. Sample input/output cases are provided.

Uploaded by

Naveenjot Kaur
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views1 page

Problem E. Approve or Reject: 1000 Ms Linux

The problem describes a manufacturing project with K tasks that must be completed within X days. Teams of workers are assigned to each task, with a team of A workers completing their task in A days. If a team's work is rejected, they resubmit on subsequent A, 2A, 3A days until approved. The goal is to find the minimum number of total workers needed across all teams to finish within X days. Sample input/output cases are provided.

Uploaded by

Naveenjot Kaur
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Coderun 04 - The Revival  

  Mar 14, 2023

Problem E. Approve or Reject


Time limit 1000 ms
Code length Limit 50000 B
OS Linux

A manufacturing project has K tasks that need to be completed. The goal is to hire K teams, one
for each task, such that all teams start working together and the project is completed in X days.
Each team has at least one worker, and a team of A workers will complete their task in A days.
The teams work independently and submit their results for approval on the A-th day. If the
project is not completed on the X-th day, the teams whose results were rejected submit new
results on every A, 2A, 3A day, and so on.
Find the smallest number of workers needed to complete the project in X days.

Input
-The first line of the input contains a single integer T denoting the number of test cases. -The
following T lines contain two space-separated integers, K and X, representing the number of
tasks and the number of days the board wants the project to be completed in, respectively.

Output
For each test case, print a single line containing the smallest number of workers required to
complete the project in X days.
Constraints:

1 ≤ T ≤ 40
2 ≤ K, X ≤ 106

Sample 1
Input Output

2 4
2 3 5
2 6

Example case 1: We can hire 1 worker for task 2 and a team of 3 workers for task 1. The 1 man
team working on task 2 completes it and submits the result for approval on each day, but it is
rejected on the 1st and 2nd day. On the 3rd day, the team working on task 1 also completes their
task, so the project gets approved after exactly 3 days.

Example case 2: We can hire a team of a team of 2 workers for task 2 and 3 workers for task 1.

You might also like