-
Notifications
You must be signed in to change notification settings - Fork 0
/
SubtaskProblem.java
46 lines (41 loc) · 989 Bytes
/
SubtaskProblem.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import java.util.*;
class SubtaskProblem {
public static void main(String[] args) {
Scanner kb = new Scanner(System.in);
int t = kb.nextInt();
while(t-->0){
int n = kb.nextInt();
int m = kb.nextInt();
int k = kb.nextInt();
int arr[] = new int[n];
for(int i=0; i<n; i++)
arr[i] = kb.nextInt();
int count = 0, flag=0;
int check = m;
for(int i=0; i<n; i++){
if(arr[i]==1){
count++;
check--;
}
else{
if(check>0){
flag = 1; //0 before req k cases
}
else{
break;
}
}
}
if(flag==1)
System.out.println("0");
else{
if(count==n){
System.out.println("100");
}
else{
System.out.println(k);
}
}
}
}
}