6 条题解
-
0
#include<bits/stdc++.h> using namespace std; const int N = 1e5+10; struct nxde { int dir; 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].dir>>a[i].name; while(m--) { cin >> x >> y; if(a[pos].dir == 0 && x == 0||a[pos].dir == 1&&x == 1) pos -= y; else pos += y; while(pos <= 0) pos += n; pos = (pos - 1)%n+1; } cout<<a[pos].name; return 0; }
信息
- ID
- 762
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 7
- 标签
- 递交数
- 203
- 已通过
- 40
- 上传者