#include <bits/stdc++.h>
using namespace std;
int num[205],st,gl,n;
queue<int> q;
int bfs(int a)
{
if(a==gl) return 0;
int count=0;
q.push(a);
while(!q.empty())
{
a=q.front();
if(a==gl) return count;
q.pop();
if(a+num[a]<=n) q.push(a+num[a]);
if(a-num[a]>0) q.push(a-num[a]);
count++;
}
return -1;
}
int main()
{
cin>>n>>st>>gl;
for(int i=0;i<n;i++) cin>>num[i];
cout<<bfs(st);
}
大佬们看看错哪了