QOJ.ac

QOJ

Limite de temps : 1.0 s Limite de mémoire : 512 MB Points totaux : 100

#81. 金字塔装饰

Statistiques

共有 $L \times (L + 1) \times (L + 2) / 6$ 块石头。Snuke 将这些石头堆成了一个四面体(一个由四个三角形面组成的 3D 物体)。石头的位置由整数元组 $(i, j, k)$ 表示(其中 $1 \le k \le j \le i \le L$)。当 $i < L$ 时,位置为 $(i, j, k)$ 的石头堆在三块石头之上,这三块石头的位置分别是 $(i + 1, j, k)$、$(i + 1, j + 1, k)$ 和 $(i + 1, j + 1, k + 1)$。

Snuke 按以下方式为这些石头上色。首先,他为最底层的所有石头上色。对于每个 $i$($1 \le i \le N$),他将位置为 $(L, A_i, B_i)$ 的石头涂成黑色,并将最底层其余的石头涂成白色。然后,他从底向上为其他石头上色。如果位置为 $(i, j, k)$ 的石头下方的三块石头(即 $(i + 1, j, k)$、$(i + 1, j + 1, k)$ 和 $(i + 1, j + 1, k + 1)$)中黑色石头的数量为零或二,则他将该石头涂成黑色。否则,他将该石头涂成白色。

确定最顶端石头的颜色。

输入格式

$L \ N$ $A_1 \ B_1$ $\vdots$ $A_N \ B_N$

  • $2 \le L \le 10^9$
  • $0 \le N \le \min(1000, L \times (L + 1) / 2)$
  • $1 \le B_i \le A_i \le L$
  • 元组 $(A_i, B_i)$ 两两不同。

输出格式

如果最顶端的石头是黑色的,输出 "Iori"。否则输出 "Yayoi"。

样例

输入 1

2 2
2 1
1 1

输出 1

Iori

输入 2

3 0

输出 2

Yayoi

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.