| 记录编号 | 
        608929 | 
        评测结果 | 
        AAAAAAAAAAAAAAAAAAAA | 
    
    
        | 题目名称 | 
        2556.[NOIP 2016]玩具谜题 | 
        最终得分 | 
        100 | 
            
    
    
        | 用户昵称 | 
         54lku | 
        是否通过 | 
        通过 | 
    
    
        | 代码语言 | 
        C++ | 
        运行时间 | 
        0.293 s  | 
    
    
        | 提交时间 | 
        2025-10-30 18:32:24 | 
        内存使用 | 
        6.76 MiB  | 
        
    
    
    
    		显示代码纯文本
		
		#include<bits/stdc++.h>
using namespace std;
bool fc[100001];
string tp[100001];
int main()
{
	freopen("toya.in","r",stdin);
    freopen("toya.out","w",stdout);
	ios::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	int n,m;
	cin>>n>>m;
	for(int i=1;i<=n;i++)
		cin>>fc[i]>>tp[i];
	int now=1;
	for(int i=1;i<=m;i++)
	{
		bool p;
		int step;
		cin>>p>>step;
		if(!((p==1&&fc[now]==1)||(p==0&&fc[now]==0)))
			now+=(step%n);
		else
			now-=(step%n);
		if(now>n)
			now%=n;
		if(now<1)
			now=(now+n)%(n+1);
	}
	cout<<tp[now];
	return 0;
}