A Subtask Problem codechef solution- Chef recently solved his first problem on CodeChef. The problem he solved has NN test cases. He gets a score for his submission according to the following rules: 1) If Chef’s code passes all the NN test cases, he gets 100100 points. 2) If Chef’s code does not pass all the test cases, but passes all the first M(M

A Subtask Problem codechef solution

Chef recently solved his first problem on CodeChef. The problem he solved has NN test cases. He gets a score for his submission according to the following rules:

1) If Chef’s code passes all the NN test cases, he gets 100100 points.

2) If Chef’s code does not pass all the test cases, but passes all the first M(M<N)M(M<N) test cases, he gets K(K<100)K(K<100) points.

3) If the conditions 11 and 22 are not satisfied, Chef does not get any points (i.e his score remains at 00 points).

You are given a binary array A1,A2,,ANA1,A2,…,AN of length NN, where Ai=1Ai=1 denotes Chef’s code passed the ithith test case, Ai=0Ai=0 denotes otherwise. You are also given the two integers M,KM,K. Can you find how many points does Chef get?

Input Format A Subtask Problem solution codechef

  • First line will contain TT, number of testcases. Then the testcases follow.
  • The first line of each test case contains three space-separated integers N,M,KN,M,K.
  • The second line contains NN space-separated integer A1,A2,,ANA1,A2,…,AN.

Output Format A Subtask Problem solution codechef

For each testcase, output in a single line the score of Chef.

Constraints A Subtask Problem solution codechef

  • 1T1001≤T≤100
  • 2N1002≤N≤100
  • 1M<N1≤M<N
  • 1K<1001≤K<100
  • 0Ai10≤Ai≤1

Sample Input 1  A Subtask Problem solution codechef 

4
4 2 50
1 0 1 1
3 2 50
1 1 0
4 2 50
1 1 1 1
5 3 30
1 1 0 1 1

Sample Output 1  A Subtask Problem solution codechef 

0
50
100
0

Explanation A Subtask Problem solution codechef

Test case 11: Chef’s code neither passes all 44 test cases nor passes the first 22 test cases. Hence he does not get any points.

Test case 22: Chef’s code does not pass all 33 test cases, but passes the first 22 test cases. Hence he gets 5050 points.

Test case 33: Chef’s code passes all the 44 test cases. Hence he gets 100100 points.