I am a beginner & i am facing issue

Question Link: Contest Page | CodeChef
Please Find the mistake in my solution–
My Solution-

``````/* 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
{

try{
Scanner input=new Scanner(System.in);
int t=input.nextInt();

while(t-->0){
int n=input.nextInt();

int a[]=new int[n];
int b[]=new int[n-1];

for(int i=0;i<n;i++)
a[i]=input.nextInt();

for(int i=0;i<n-1;i++)
b[i]=input.nextInt();

int sum=0,arrSum=0;
int minValue=Integer.MAX_VALUE;
int totalSum=0;

for(int i=0;i<n-1;i++)
sum+=b[i];

for(int i=0;i<n;i++)
totalSum+=a[i];

for(int i=0;i<n;i++){
arrSum=totalSum-a[i];

int diff=sum-arrSum;

if(diff%(n-1)==0){
int x=diff/(n-1);
if(x>0 && x<minValue)
minValue=x;

}

arrSum=0;
}

System.out.println(minValue);
}
}catch(Exception e){
return;
}

}
}

``````