| 比赛 |
csp2025模拟练习2 |
评测结果 |
AAAAAAAAAAAAAAAAAAAA |
| 题目名称 |
玩具谜题 |
最终得分 |
100 |
| 用户昵称 |
梦那边的美好TE |
运行时间 |
0.287 s |
| 代码语言 |
C++ |
内存使用 |
6.86 MiB |
| 提交时间 |
2025-10-29 08:50:49 |
显示代码纯文本
#include <iostream>
#include <cstdio>
using namespace std;
const int N=1e5+10;
int n,m,a[N],pos=1;
string s[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=1;i<=n;i++){
cin>>a[i]>>s[i];
if(!a[i])a[i]=-1;
}
while(m--){
int o,v;cin>>o>>v;
if(!o)o=-1;o*=-1;o*=a[pos];
if(o==-1)pos=((pos-1-v)%n+n)%n+1;
else pos=((pos-1+v)%n+n)%n+1;
}
cout<<s[pos]<<endl;
return 0;
}