第四个点有1001条指令,自己测试时最后输出cur确实是1,但是为啥不会输出玩具的名字呢?
#include<iostream>
#include<string>
using namespace std;
struct P{
int face;
string name;
} ps[100000 + 10];
int main(){
int n, m;
cin >> n >> m;
for(int i = 1; i <= n; i++)
cin >> ps[i].face >> ps[i].name;
int dir, num, cur = 1;
for(int i = 0; i < m; i++){
cin >> dir >> num;
if((ps[cur].face == 0 && dir == 0) || (ps[cur].face == 1 && dir == 1))
cur += n - num;
else
cur += num;
cur %= n;
// cout << "cur = " << cur << endl;
}
cout << ps[cur].name;
return 0;
}