90分求调
查看原帖
90分求调
1063582
张东篱2011楼主2024/10/3 22:48
#include<bits/stdc++.h>
using namespace std;
struct node{
	int x;
	string name;
}a[1000005];
int main()
{
	int n,m;
	cin>>n>>m;
	for(int i=1;i<=n;i++) cin>>a[i].x>>a[i].name;
	int now=1;
	while(m--)
	{
		int x,s;
		cin>>x>>s;
		if(x==0 and a[now].x==0) now=(now+n-s)%n;
		else if(x==0 and a[now].x==1) now=(now+s)%n;
		else if(x==1 and a[now].x==0) now=(now+s)%n;
		else now=(now+n-s)%n;
	}
	cout<<a[now].name<<endl;
	return 0;
}
2024/10/3 22:48
加载中...