Chef and Division 3 Codechef january challenge solution || Chef and Division 3 Codechef january challenge Editorial 2021
Chef and Division 3 Codechef january challenge solution || Chef and Division 3 Codechef january challenge Editorial-
Problem statement-
Chef wants to host some Division-3 contests. Chef has setters who are busy creating new problems for him. The setter has made problems where .
A Division-3 contest should have exactly problems. Chef wants to plan for the next days using the problems that they have currently. But Chef cannot host more than one Division-3 contest in a day.
Given these constraints, can you help Chef find the maximum number of Division-3 contests that can be hosted in these days?
Input:
- The first line of input contains a single integer denoting the number of test cases. The description of test cases follows.
- The first line of each test case contains three space-separated integers - , and respectively.
- The second line of each test case contains space-separated integers respectively.
Output:
For each test case, print a single line containing one integer ― the maximum number of Division-3 contests Chef can host in these days.
Constraints
- for each valid
Subtasks
Subtask #1 (40 points):
Subtask #2 (60 points): Original constraints
Sample Input:
5
1 5 31
4
1 10 3
23
2 5 7
20 36
2 5 10
19 2
3 3 300
1 1 1
Sample Output:
0
2
7
4
1
Explanation:
Example case 1: Chef only has problems and he needs problems for a Division-3 contest. So Chef won't be able to host any Division-3 contest in these 31 days. Hence the first output is .
Example case 2: Chef has problems and he needs problems for a Division-3 contest. Chef can choose any problems and host Division-3 contests in these 3 days. Hence the second output is .
Example case 3: Chef has problems from setter-1 and problems from setter-2, and so has a total of problems. Chef needs problems for each Division-3 contest. Hence Chef can prepare Division-3 contests. But since we are planning only for the next days and Chef cannot host more than contest in a day, Chef cannot host more than contests. Hence the third output is .
Comments
Post a Comment