不知道为什么50分
#include<bits/stdc++.h>
using namespace std;
int l,A,B;
queue<int> flr;
int step=0;
int stage[210]={0};
int mom[210]={0};
void dfs(){
int x=flr.front();
if(x==B){mom[B]=step;return ;}
if(x<1 or x>l){flr.pop();return;}
if(mom[x]!=0){flr.pop();return;}
mom[x]=step;
step++;
flr.push(x+stage[x]);
flr.push(x-stage[x]);
flr.pop();
return;
}
int main(){
cin>>l>>A>>B;
int i;
for(i=1;i<=l;i++){cin>>stage[i];}
flr.push(A);
mom[B]=-1;
while(mom[B]==-1 and flr.empty()==false){
dfs();
}
cout<<mom[B];
}