「NOIp2016」题解

$???$就一道紫题$???$,还是$D1T2\ ???$

$D1T1$ 玩具迷题

简单的__模拟__,没的说

代码

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <bits/stdc++.h>
using namespace std;

struct Node{
int towards;
string name;
} a[100001];

int n, m, ai, si;

int main() {
cin >> n >> m;
for (int i = 0; i < n; ++i) {
cin >> a[i].towards >> a[i].name;
}
int peo = 0;
for (int i = 1; i <= m; ++i) {
cin >> ai >> si;
if (ai == 0 && a[peo].towards == 0) peo = (peo + n - si) % n;
else if (ai == 0 && a[peo].towards == 1) peo = (peo + si) % n;
else if (ai == 1 && a[peo].towards == 0) peo = (peo + si) % n;
else if (ai == 1 && a[peo].towards == 1) peo = (peo + n - si) % n;
}
cout << a[peo].name << endl;
return 0;
}
/* 430ms 4760kB */
作者

TonyCrane

发布于

2019-05-03

更新于

2020-05-05

许可协议