Question: please provide a cpp code for the given problem You are about to join a Guild. There are N potions in this guild, each with
please provide a cpp code for the given problem
You are about to join a Guild. There are N potions in this guild, each with specific brewing requirements. You have been given a REQUIREMENTS list of size M where REQUIREMENTSi consists of PiQi indicating that potion Pi must be brewed before potion Qi can be brewed. In one brewing cycle, you can prepare at most K potions. Thus, you must determine the minimum number of brewing cycles required to brew all potions successfully.
Note: It is guaranteed that there is a feasible sequence to brew all the potions. The most optimal solution is not required.
Format :
The first line of each test case contains three single spaceseparated integers NM and K representing the number of potions, number of requirements, and maximum potions that you can brew in one brewing cycle, respectively.
The next M line of each test case contains two single spaceseparated integers P and Q representing that the potion P must be brewed before the potion Q
Constraints:
N
M N N
Q P and K N
Input :
Output :
Potion can be brewed after potions and are brewed. Potion can be brewed after
potion is brewed.
Input :
Output :
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
