September 26, 2023
Latest:
TechInfo

# Score and Cost CodeKaze June23 Round 2 Solution || India’s Biggest Hiring Challenge

## Score and Cost CodeKaze June23 Round 2 Solution || India’s Biggest Hiring Challenge ## Problem Statement

#### Return the minimum ‘M’ such that you can get a total score of at least ‘X’ if you can purchase exactly one game for free. Return ‘-1’ if it is impossible.

##### For Example :
``````Let 'N' = 3, 'A' = [ 3, 7, 1 ], 'B' = [ 2, 4, 4 ], 'X' = 9.
The total score is '3 + 7 = 10', and the value of 'M' is 2.
It can be shown that this is the minimum 'M' possible.
``````
Detailed explanation ( Input/output format, Notes, Images ) ##### Constraints :
``````1 <= 'T' <= 10
1 <= 'N' <= 10^5
1 <= 'X, A[i], B[i]' <= 10^9

Time Limit: 1 sec
``````
##### Sample Input 1 :
``````2
3 11
4 2 6
14 7 7
3 100
11 3 5
10 7 9
``````
##### Sample Output 1 :
``````7
-1
``````
##### Explanation Of Sample Input 1 :
``````First test case:-
We buy the first game for free and the other two games for a cost of '7' each.
The total score is '4 + 2 + 6 = 12', and the value of 'M' is 7.
It can be shown that this is the minimum 'M' possible.

Second test case:-
It can be shown that it is impossible to get a total score of at least 'X'.
``````
##### Sample Input 2 :
``````2
5 17
5 4 3 1 6
10 11 12 13 14
4 30
9 17 6 3
17 15 9 12
``````
##### Sample Output 2 :
``````12
15`````` 6 digit code appear after 69 seconds.

Wait for  Solution