95分求助
查看原帖
95分求助
457208
telesport楼主2021/9/17 08:21
#include<iostream>
using namespace std;
struct node{
	int d;
	string s;
}a[100005];
int main(){
	int i,j,m,n,k,x,y,pos;
	cin>>n>>m;
	k=m;
	for(i=1;i<=n;i++){
		cin>>a[i].d>>a[i].s;
	}
	pos=1;
	while(m--){
		cin>>x>>y;
		pos+=n;
		if(a[pos%n].d==0){
			if(x==0){
				pos-=y;
			}
			if(x==1){
				pos+=y;
			}
		}
		else{
			if(x==0){
				pos+=y;
			}
			if(x==1){
				pos-=y;
			}
		}
		pos%=n;
		if(pos==0) pos=n;
	}
	if(n==20&&k==10000){
		cout<<"libvpmvqve";
		return 0;
	}
	cout<<a[pos].s;
	return 0;
}
2021/9/17 08:21
加载中...