4TLE求救!
查看原帖
4TLE求救!
339299
osfly楼主2021/2/8 12:16
#include<iostream>
#include<string.h>
using namespace std;
struct r
{
	int t;		//朝向 
	string j;	//职业 
}xr[100100];
int n,m;
int d,num;		//方向,人 
int tot=1;
int main()
{
	cin>>n>>m;
	for(int i=1;i<=n;i++) cin>>xr[i].t>>xr[i].j;
	for(int i=0;i<m;i++)
	{
		cin>>d>>num;
		//0左1右 0内1外 
		if((d==0&&xr[tot].t==1)||(d==1&&xr[tot].t==0))	//tot+
			for(int j=0;j<num;j++)
			{
				tot++;
				if(tot>n) tot=1;
			}
		else	//tot-
			for(int j=0;j<num;j++)
			{
				tot--;
				if(tot<1) tot=n;
			}
	}
	cout<<xr[tot].j;
	return 0;
}
2021/2/8 12:16
加载中...