QOJ.ac

QOJ

Time Limit: 1.0 s Memory Limit: 512 MB Total points: 100

#81. 金字塔裝飾

Statistics

有 $L \times (L + 1) \times (L + 2)/6$ 顆石頭。Snuke 將這些石頭堆成四面體的形狀(即由四個三角形面構成的三維物體)。一顆石頭的位置以整數三元組 $(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)$)中,黑色石頭的數量為零或二,他就將這顆石頭塗成黑色。否則,他將這顆石頭塗成白色。

求最頂端石頭的顏色。

輸入格式

$$ \begin{gathered} L\quad N\\ A_1\quad B_1\\ \vdots\\ A_N\quad B_N \end{gathered} $$

  • $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.