// i did add the "evacuate " case still the same result #konoha_still_in_danger
If you are getting NZEC on running then the reason could be that , U are not giving TC while running your program on CC , do remember that Unlike Hackerearth and Hackerrank , in CC you have to write sample test cases as well in sample input section
/* package codechef; // don’t place package name! */
import java.util.;
import java.lang.;
import java.io.*;
/* Name of the class has to be “Main” only if the class is public. */
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
int count = 0;
int x = 0;
for (int v = 0; v < t; v++) {
int n = sc.nextInt();
long power = sc.nextLong();
long maxpo = 0;
long[] arr = new long[(int) n];
for (int i = 0; i < n; i++) {
long a = sc.nextLong();
arr[i] = a;
}
for (int i = 0; i < n; i++) {
maxpo = Math.max(maxpo, arr[i]);
}
int z = 0;
while (maxpo != arr[z]) {
z = z + 1;
}
while (power > 0) {
power = power - maxpo;
arr[z] = arr[z] / 2;
maxpo = Math.max(maxpo, arr[x]);
x += 1;
count = count + 1;
}
if(count>n){
System.out.print("EVACUATE");
}else{
System.out.println(count);
}
}
}
}
sample test case(s) work perfectly fine
write the code in try block…it will work