QOJ.ac

QOJ

時間限制: 1.0 s 記憶體限制: 512 MB 總分: 100

#81. 金字塔裝飾

统计

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