比赛 csp2025模拟练习2 评测结果 AAAAAAAAAAAAAAAAAAAA
题目名称 玩具谜题 最终得分 100
用户昵称 54lku 运行时间 0.305 s
代码语言 C++ 内存使用 6.79 MiB
提交时间 2025-10-29 10:00:22
显示代码纯文本
#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;
}