- 复习
玩具谜题 80分你帮我看看错哪了
- @ 2024-11-11 20:45:47
#include<bits/stdc++.h>
using namespace std;
long long m,n,s[100000],a[100000],x[1000000],o=1;
string y[100000];
int main(){
cin>>n>>m;
for(int i=1;i<=n;i++){
cin>>x[i];
cin>>y[i];
}
for(int i=1;i<=m;i++){
cin>>a[i]>>s[i];
}
for(int i=1;i<=m;i++){
if((x[o]==0&&a[i]==0)||(x[o]==1&&a[i]==1)){
if(o-s[i]<=0){
o=n+(o-s[i]);
}
else{
o=o-s[i];
}
}
else{
if(o+s[i]>n){
o=o+s[i]-n;
}
else{
o=o+s[i];
}
}
}
cout<<y[o];
return 0;
}
0 comments
No comments so far...