TechInfo

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

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

Answers will be Uploaded Shortly and it will be Notified on Telegram, So JOIN NOW
JoinScishowEngineerTelegram

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

Problem Statement

You have just developed a video game that tells a non-linear story from the perspective of ‘M’ protagonists. There are ‘N’ different chapters in the story. Each chapter is seen from the perspective of one of the protagonists and has some conditions to be unlocked.

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.
Thus, the answer is '1'.
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.
Thus, the answer is '1'.

Second test case:-
Both chapters require completing a non-zero percentage of the overall story.
Therefore, we cannot do either of them.
Thus, the answer is '0'.
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
Answers will be Uploaded Shortly and it will be Notified on Telegram, So JOIN NOW
JoinScishowEngineerTelegram


6 digit code appear after 69 seconds.
 

Wait for  Solution


We are Still Solving…. Please Visit Our Social Media Handle Till Then

Here Discuss About Remembrance CodeKaze June23 Round 2 Solution || India’s Biggest Hiring Challenge

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

 

Yhaa You have done it but next? if YOU Want to Get Others Please Visit Here ScishowEngineer   Then Follow US HERE and Join Telegram.

If You Want To Learn Something New Then Visit Our Official Channel YOUTUBE