September 25, 2023
Latest:
TechInfo

# Remembrance CodeKaze June23 Round 2 Solution || India’s Biggest Hiring Challenge

## Remembrance CodeKaze June23 Round 2 Solution || India’s Biggest Hiring Challenge ## Problem Statement

#### The conditions for a chapter are given by the combination of an integer ‘P’ and an array ‘C’.

``````'P' represents the percentage of the overall story you must complete.
'C'  is an array of length 'M' such that 'C[i]' is a chapter from the 'i-th' protagonist's perspective that you must complete, or '-1' if there is no requirement.
``````

#### The game launches tomorrow. You want to perform one last check that it is possible to finish the game, i.e., do all ‘N’ chapters in an order that satisfies the conditions. Return ‘1’ if such an order exists and ‘0’ otherwise.

##### For Example :
``````Let 'M' = 2, 'N' = 3, conditions = [ [ 60, -1, -1 ], [ 0, -1, -1 ], [ 0, 1, -1 ] ].
The first chapter is not dependent on any specific chapter, but it needs 'P = 60%' total completion; Since there are '3' chapters, doing at least '2' will pass this requirement.
The second chapter has no requirements.
The third chapter does not have a total completion requirement, but it needs the second chapter completed.
Therefore, we can complete all 'N' chapters in the order: Second → Third → First.
``````
Detailed explanation ( Input/output format, Notes, Images ) ##### Constraints :
``````1 <= 'T' <= 10
2 <= 'M' <= 13
1 <= 'N' <= 10^5
0 <= 'P' <= 99
-1 <= 'C[i]' < N

Time Limit: 1 sec
``````
##### Sample Input 1 :
``````2
2 4
75 -1 2
10 3 -1
0 -1 -1
25 -1 -1
2 2
20 -1 -1
30 -1 -1
``````
##### Sample Output 1 :
``````1
0
``````
##### Explanation Of Sample Input 1 :
``````First test case:-
The first chapter requires the third chapter to be completed, and it needs 'P = 75%' total completion; Since there are '4' chapters, doing at least '3' will pass this requirement.
The second chapter requires the fourth chapter to be completed, and it needs 'P = 10%' total completion; Since there are '4' chapters, doing at least '1' will pass this requirement.
The third chapter has no requirements.
The fourth chapter is not dependent on any specific chapter, but it needs 'P = 25%' total completion; Since there are '4' chapters, doing at least '1' will pass this requirement.
Therefore, we can complete all 'N' chapters in the order: Third → Fourth → Second → First.

Second test case:-
Both chapters require completing a non-zero percentage of the overall story.
Therefore, we cannot do either of them.
``````
##### Sample Input 2 :
``````2
2 5
0 -1 -1
1 -1 -1
10 -1 -1
37 -1 -1
99 -1 -1
2 4
0 -1 3
0 -1 2
0 0 -1
0 -1 -1
``````
##### Sample Output 2 :
``````0
1`````` 6 digit code appear after 69 seconds.

Wait for  Solution