```cpp
#include <iostream>
#include <cstring>
using namespace std;
struct Toy
{
int h;
string n;
}t[1000005];
int main()
{
int n, m;
cin >> n >> m;
for (int i = 1; i <= n; ++i)
{
cin >> t[i].h >> t[i].n;
}
int p = 1;
for (int i = 1; i <= m; ++i)
{
int a, b;
cin >> a >> b;
if (t[p].h + a == 1) p = (p + b) % n;
else p = (p + n - b) % n;
if (p == 0) p = n;
}
cout << t[p].n;
return 0;
}
```
[过了](https://www.luogu.com.cn/record/109444861),23 行那个 `t[i].h` 应该是 `t[p].h` 才对
by ForgotDream_CHN @ 2023-05-03 09:22:10
@[Howson_20120405](/user/741732)
by ForgotDream_CHN @ 2023-05-03 09:22:20
谢谢大佬回复,已关注
by small_Dongpo @ 2023-05-03 14:06:44