diff --git a/problem/P1563/P1563.cpp b/problem/P1563/P1563.cpp new file mode 100644 index 00000000..a05c5fcf --- /dev/null +++ b/problem/P1563/P1563.cpp @@ -0,0 +1,41 @@ +// R38818598 + +#include + +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; +} diff --git a/problem/P1563/data/P1563_sample1.in b/problem/P1563/data/P1563_sample1.in new file mode 100644 index 00000000..9f792334 --- /dev/null +++ b/problem/P1563/data/P1563_sample1.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5c1cfa4c45c49a5c132a271f84325954cf2da86a0588bc0fbdc0a8d323d4a8d0 +size 86 diff --git a/problem/P1563/data/P1653_sample1.out b/problem/P1563/data/P1653_sample1.out new file mode 100644 index 00000000..12a99934 --- /dev/null +++ b/problem/P1563/data/P1653_sample1.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1bc7176777a66b930115f241c538162ef39c9e4f3e109804bfbb01e1a068ee97 +size 7