比赛 |
20190908之惊鸿 |
评测结果 |
AAAAAAAAAAAAAAAAAAAA |
题目名称 |
玩具谜题 |
最终得分 |
100 |
用户昵称 |
第二代米特尼克 |
运行时间 |
0.510 s |
代码语言 |
C++ |
内存使用 |
15.19 MiB |
提交时间 |
2019-09-18 19:57:33 |
显示代码纯文本
#include<bits/stdc++.h>
using namespace std;
struct worker
{
int fob;
string work;
}a[100001];
int main()
{
freopen("toya.in","r",stdin);
freopen("toya.out","w",stdout);
int n,m;
cin>>n>>m;
for(int i=1;i<=n;i++)
{
cin>>a[i].fob>>a[i].work;
}
int p=1;
for(int i=1;i<=m;i++)
{
int x,y;
cin>>x>>y;
if((a[p].fob==0&&x==0)||(a[p].fob==1&&x==1))
{
if(p<=y)
p=p+n-y;
else
p=p-y;
}
else
{
if(p+y>n)
p=p+y-n;
else
p=p+y;
}
}
cout<<a[p].work;
return 0;
}