| 比赛 |
csp2025模拟练习2 |
评测结果 |
AAAAAAAAAAAAAAAAAAAA |
| 题目名称 |
玩具谜题 |
最终得分 |
100 |
| 用户昵称 |
会挽弯弓满月 |
运行时间 |
0.420 s |
| 代码语言 |
C++ |
内存使用 |
7.60 MiB |
| 提交时间 |
2025-10-29 09:05:45 |
显示代码纯文本
#include <bits/stdc++.h>
using namespace std;
const int N=1e5+10;
int n,m,a,b;
struct people{
int opt;
string job;
}s[N];
//内:0 外:1
//左:0 右:1
int main(){
freopen("toya.in","r",stdin);
freopen("toya.out","w",stdout);
scanf("%d%d",&n,&m);
for(int i=1;i<=n;i++){
cin>>s[i].opt>>s[i].job;
}
int now=1;
for(int i=1;i<=m;i++){
scanf("%d%d",&a,&b);
if(s[now].opt==a) now=(now-b+n)%n;
else now=(now+b)%n;
if(now==0) now=n;
}
cout<<s[now].job;
return 0;
}