比赛 csp2025模拟练习2 评测结果 AAAAAAAAAAAAAAAAAAAA
题目名称 玩具谜题 最终得分 100
用户昵称 李奇文 运行时间 0.769 s
代码语言 C++ 内存使用 41.85 MiB
提交时间 2025-10-29 09:01:30
显示代码纯文本
#include<bits/stdc++.h>
using namespace std;
const int N=1e6;
int n,m,ans,k;
struct node{
	int tou;
	string name;
}a[N];
int main(){
	freopen("toya.in","r",stdin);
	freopen("toya.out","w",stdout);
	ios::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	cin>>n>>m;
	for(int i=0;i<n;i++){
		cin>>a[i].tou>>a[i].name;
	}
	for(int i=0;i<m;i++){
		int b,c;
		cin>>b>>c;
		if(b==0&&a[ans].tou==0){
			ans=(ans+n-c)%n;
		}else if(b==0&&a[ans].tou==1){
			ans=(ans+c)%n;
		}else if(b==1&&a[ans].tou==0){
			ans=(ans+c)%n;
		}else if(b==1&&a[ans].tou==1){
			ans=(ans+n-c)%n;
		}
	}
	cout<<a[ans].name<<endl;
	return 0;
}