没意义,注意方向别判错。
Code:
#include<cstdio>
#include<cstring>
using namespace std;
const int maxn = 100000 + 3;
char A[maxn][100];
int face[maxn];
int main()
{
// freopen("in.txt","r",stdin);
int n,m;
scanf("%d%d",&n,&m);
for(int i = 0;i < n; ++i)
{
scanf("%d",&face[i]);
scanf("%s",A[i]);
}
int cur = 0;
while(m--)
{
int a,s;
scanf("%d%d",&a,&s);
int flag = (face[cur] + a) % 2;
if(flag == 1) cur = (cur + s + n) % n;
if(flag == 0) cur = (cur - s + n) % n;
}
for(int i = 0;i < strlen(A[cur]); ++i)printf("%c",A[cur][i]);
return 0;
}