90pts求调
查看原帖
90pts求调
942651
Tao_Jianxuan楼主2025/7/1 10:06

源代码:

#include<bits/stdc++.h>
using namespace std;
int n,m,s[100005];
bool a[100005];
struct people{
	bool way;
	string name;
}man[100005];
int main(){
	ios::sync_with_stdio(0);
	cin>>n>>m;
	for(int i=0;i<n;i++){
		cin>>man[i].way>>man[i].name;
	}
	int x=0;
	for(int i=0;i<m;i++){
		cin>>a[i]>>s[i];
		if(a[i]){
			if(man[x].way){                
				x-=s[i];
			}else{
				x+=s[i];
			}
		}else{
			if(man[x].way){
				x+=s[i];
			}else{
				x-=s[i];
			}
		}
		if(x>n){
			x-=n;
		}else if(x<0){
			x+=n;
		}
	}
	cout<<man[x].name;
	return 0;
}
	
2025/7/1 10:06
加载中...