0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-12-25 07:11:58 +00:00

P1563 玩具谜题

R38818598
This commit is contained in:
Baoshuo Ren 2020-09-24 18:35:01 +08:00 committed by Baoshuo Ren
parent 5e71c49e9d
commit 40e26e2bf5
Signed by: baoshuo
GPG Key ID: 70F90A673FB1AB68
3 changed files with 47 additions and 0 deletions

41
problem/P1563/P1563.cpp Normal file
View File

@ -0,0 +1,41 @@
// R38818598
#include <bits/stdc++.h>
using namespace std;
struct node {
string name;
bool towards;
};
int main() {
// freopen("data/P1563_sample1.in", "r", stdin);
int n, m, now = 0, x, y;
node a[100005];
cin >> n >> m;
for (int i = 0; i < n; i++) {
cin >> a[i].towards >> a[i].name;
}
for (int i = 0; i < m; i++) {
cin >> x >> y;
if (a[now].towards == 0) {
if (x == 0) {
now = (now + n - y) % n;
}
else if (x == 1) {
now = (now + y) % n;
}
}
else if (a[now].towards == 1) {
if (x == 0) {
now = (now + y) % n;
}
else if (x == 1) {
now = (now + n - y) % n;
}
}
}
cout << a[now].name << endl;
return 0;
}

BIN
problem/P1563/data/P1563_sample1.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
problem/P1563/data/P1653_sample1.out (Stored with Git LFS) Normal file

Binary file not shown.