why am i getting SIGSEGV error in this program??

#include<bits/stdc++.h>
using namespace std;

int main()
{
//int arr[100000];
int t;
cin>>t;
while(t–>0)
{
int n;
cin>>n;
//int arr1[n];
vector arr; //arr[n+1];//to store sum
arr.push_back(0);
for(int i=1;i<=n;i++)
{
int n1;
cin>>n1;
arr.push_back(n1);
arr[i]=n1+arr[i-1];
//cout<<arr[i]<<"\t";
}
//cout<<"\n";
int result=0;
for(int j=1;j<n;j+=arr[j])
{
result++;
//cout<<result<<"\n";
}
cout<<result<<"\n";
}
}

Kindly edit your question so that the code is legible. Also, try to give the link to the problem/constraints

//