6 条题解
-
0
#include <queue> #include <math.h> #include <stack> #include <stdio.h> #include <iostream> #include <vector> #include <iomanip> #include <string.h> #include <algorithm> #include<fstream> using namespace std; #define LL long long const int N = 1e5 + 10; const int INF = 0x3f3f3f3f; int n, m,cnt = 1; struct node { int fx; string name; }a[N]; int x, y; int main() { freopen("toy.in", "r", stdin); freopen("toy.out", "w", stdout); cin >> n >> m; for (int i = 1; i <= n; i++) { cin >> a[i].fx>>a[i].name; } while (m--) { cin >> x >> y; if (x == 0 && a[cnt].fx || x == 1 && a[cnt].fx == 0) cnt += y; else cnt -= y; while (cnt <= 0) cnt += n; while (cnt > n) cnt -= n; } cout << a[cnt].name << endl; return 0; }
信息
- ID
- 762
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 7
- 标签
- 递交数
- 203
- 已通过
- 40
- 上传者