Hello, niece and nephew, it's Uncle Benson.
Uncle Benson realized there is this new wonderful form of sequence called "poop".
Just yesterday, Uncle Benson don't know what poop is.
But I discovered this wonderful page called, "poopsequences".
So interesting, Uncle Benson love so much.
So today, Uncle Benson gonna react to niece and nephew poops of Uncle Benson.
Some are good, some are terrible.
Now you are Uncle Benson, and you want to react to the poops.
What you need to do is to distinguish between good poop and bad poop.
You will have given a page in each testcase.
Each page contains three coefficients $a,b,c$ and a bunch of poops.
A poopsequence is good if $P_{n+3}=a\times P_{n+2}+b\times P_{n+1}+c\times P_{n}$, $n\in \mathbb{N}$
A poop contain two integers $Q_i,A_i$ ,and a poop is good if $P_{Q_{i}}\equiv A_i \ (mod \ 998244353)\ $
The base cases are $P_1=1, P_2=2, P_3=3$
The first line contains one integer $n$: the number of poops.
The second line contains three integer $a$, $b$, $c$: the coefficients of the poopsequence.
In each of the next of $n$ lines there are the poops.
The $i$-th line contains two integers $Q_i$ and $A_i$
For each poop, print "fuiyoh"(without quotes) if it's good.
Otherwise, print "haiyaa"(without quotes).
3 1 1 1 1 2 2 2 3 2
haiyaa fuiyoh haiyaa
$\forall$ $1\leq n\leq 10^5$, $1\leq a,b,c\leq 10^3$, $max(Q_i) \leq 10^5$, $-10^9\leq A_i\leq 10^9$
#0 $1\leq n\leq 10^2$, $max(Q_i) \leq 10^2$
#1 $1\leq n\leq 10^3$, $max(Q_i) \leq 10^3$
#2 $no\ limit$
編號 | 身分 | 題目 | 主題 | 人氣 | 發表日期 |
沒有發現任何「解題報告」 |