#include<cstdio>
#include<cstring>
const int max1=1e5+10;
int n,a[max1];
char str[max1];
int main()
{
scanf("%d",&n);
scanf("%s",str+1);
int k=1;
for(int i=1;i<=n;i++)
scanf("%d",&a[i]);
for(int i=1;i<=n;i++)
{
if(str[k]=='>')
k+=a[k];
else
k-=a[k];
if(k<1||k>n)
{
printf("FINITE\n");
return 0;
}
}
printf("INFINITE\n");
return 0;
}
codeforces 669B Little Artem and Grasshopper
最新推荐文章于 2022-05-13 16:51:40 发布