救命
查看原帖
救命
1321274
Zivsfamily楼主2024/9/17 17:57

看这里 https://www.luogu.com.cn/record/177346322
代码如下——>>

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

ll n,m;
ll u=1;

struct toy{
	bool p;
	string name;
};
toy a[100005];

void puzzle(bool& l,ll& r,ll& t){
	if(a[t].p){
		if(l==0)
			t+=r;
		else
			t-=r;
	}else{
		if(l)
			t+=r;
		else
			t-=r;
	}
	if(t>n)
		t-=n;
	if(t<0)
		t+=n;
}
int main(){
	cin>>n>>m;
	for(ll i=1;i<=n;i++){
		cin>>a[i].p>>a[i].name;
	}
	for(ll i=1;i<=m;i++){
		bool x;
		ll y;
		cin>>x>>y;
		puzzle(x,y,u);
	}
	cout<<a[u].name<<endl;
	return 0;
} ```
2024/9/17 17:57
加载中...