# what is wrong with my code..??

plzz help me finding the error in my solution
Question link- http://www.codechef.com/problems/DEVBDAY/

#include<stdio.h>
int st;
int arr1[100001];long long int arr2[100001];
char arr3[100001];
long int sum(int );

int main()
{
int t,n,i; scanf("%d",&t);
while(t–)
{
long long int max=0,temp; //printf(“value of max is=%d\n”,max);
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&arr1[i]);
}
for(i=0;i<n;i++)
{
scanf("%d",&arr2[i]);
}

``````   for(i=0;i<n;i++)
{
arr3[i]=NULL;
}
i=0;
while(i<=n-1)
{
if(arr2[i]>0)
{
st=i;
temp=sum(i);
}

if(max<temp)
{
max=temp;
}
i++;
}
printf("%lld\n",max);
}
``````

return 0;
}

long int sum(int i)
{
if(arr3[i]!=‘v’)
{ arr3[i]=‘v’;
arr2[i]=arr2[i]+ sum(arr1[i]-1);
return arr2[i];
}

``````  else
{
if(st==i)
return 0;

else
return arr2[i];
}
``````

}

I checked for this solution of yours.

Use `%lld` for scanning elements of `arr2`.

I just checked with sample test cases. On doing this change, it’s now working for sample test cases which wasn’t previously working when `arr2` array elements are scanned using `%d`.