❤ • 16天前
#include <bits/stdc++.h>
using namespace std;
struct people {
int cx;
string name;
} p[100005];
int n, m, der, step, cur = 1;
int main() {
cin >> n >> m;
for (int i = 1; i <= n; i++) {
cin >> p[i].cx >> p[i].name;
}
while (m--) {
cin >> der >> step;
if ((der == 0 && p[cur].cx == 0) || (der == 1 && p[cur].cx == 1)) {
cur = (cur + n - step-1) % n+1;
} else {
cur = (cur + step-1) % n+1;
}
}
cout << p[cur].name;
return 0;
}
评论:
请先登录,才能进行评论