6 条题解
-
0
#include<iostream> #include<cstdio> #include<string> #include<bits/stdc++.h> #define LL long long using namespace std; const int INF=0x3f3f3f3f; const int N=2e5+10; struct node{ int fx; string name; }a[N]; int n,m,x,y,pos=1; int main(){ cin>>n>>m; for(int i=1;i<=n;i++){ cin>>a[i].fx>>a[i].name; } while(m--){ cin>>x>>y; if(a[pos].fx==0&&x==0||a[pos].fx==1&&x==1) pos-=y; else pos+=y; while(pos<=0) pos+=n; pos=(pos-1)%n+1; } cout<<a[pos].name; }
信息
- ID
- 762
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 7
- 标签
- 递交数
- 203
- 已通过
- 40
- 上传者