#include <bits/stdc++.h>
//13:45
//环形数组
using namespace std;
typedef struct
{
string s;
int sign;
}people;
people* q = new people[100003];
int main()
{
int res=0;
int n,m;
cin>>n>>m;
for(int i=0;i<n;i++){
cin>>q[i].sign>>q[i].s;
}
for(int i=1;i<=m;i++){
int direction;
cin>>direction;
int step;
cin>>step;
step = step%n;
if(q[res].sign==0){
if(direction==0) res = (res-step+n)%n;
else res = (res+step)%n;
}
else{
if(direction==1) res = (res-step+n)%n;
else res = (res+step)%n;
}
}
cout<<q[res].s<<endl;
return 0;
}
EOJ_1018_玩具谜题
最新推荐文章于 2024-09-03 11:25:36 发布