It is working properly in Eclipse and in Codechef also, it is showing me the output when I run it for custom input, but when I click the run button, it gives this error.
Can someone please help me
Here is the code:
/* package codechef; // don’t place package name! */
import java.util.*;
/* Name of the class has to be “Main” only if the class is public. */
class Codechef
{
static int Kill(int n, int C[], int H[])
{
int arr[] = new int[n];
for(int i=0;i<n;i++)
{
if(i-C[i]<0)
arr[0]++;
else
arr[i]++;
if(i+C[i]+1<n)
arr[i+C[i]+1]-=1;
}
for(int i=1;i<n;i++)
{
arr[i]+=arr[i-1];
}
Arrays.sort(arr);
Arrays.sort(H);
if(Arrays.equals(arr,H))
System.out.print("YES");
else
System.out.print("NO");
return 0;
}
public static void main (String args[])
{
// your code goes here
Scanner S = new Scanner(System.in);
int t = S.nextInt();
while(t>0)
{
int n = S.nextInt();
int C[] = new int[n];
for(int i=0;i<n;i++)
C[i]=S.nextInt();
int H[] = new int[n];
for(int i=0;i<n;i++)
H[i] = S.nextInt();
Kill(n,C,H);
t--;
}
}
}