| UTPC Contest 09-08-23 Div. 1 |
|---|
| Закончено |
Ivan and Isabel are iguanas who live in the Iguana Islands. The archipelago consists of $$$N$$$ islands ($$$1 \leq N \leq 2*10^5$$$), indexed from $$$1..N$$$ and arranged in line in the order of their indices, each of which consists of a single type of fruit denoted as $$$f_i$$$. The amount of fruit on island $$$i$$$ is denoted as $$$q_i$$$. ($$$1 \leq f_i, q_i \leq 10^9$$$). The fruits on these islands are special, and can only be eaten in quantities of $$${f_i}^k$$$, where k is a non-negative integer ($$$0 \leq k$$$). During each of the next Q days ($$$1 \leq Q \leq 2*10^5$$$), the following will happen:
For each of the $$$Q$$$ days, determine which iguana will be well-fed, assuming the iguanas are very intelligent, and will always make the decision which minimizes their chance of starving at the end of the day.
The first line of input will contains integers $$$N$$$ and $$$Q$$$. ($$$1 \leq N, Q \leq 2*10^5$$$) The second line will contain $$$N$$$ space-separated integers $$$f_1 ... f_N$$$, denoting the type of fruit on each island. ($$$1 \leq f_i \leq 10^9$$$) Similarly, the third line will contain $$$N$$$ integers $$$q_1 ... q_N$$$, representing the amount of fruit on each island. ($$$1 \leq q_i \leq 10^9$$$) The next $$$Q$$$ lines will describe which islands are available on each day, which is represented by two integers $$$l_i$$$ and $$$r_i$$$. ($$$1 \leq l_i \leq r_i \leq N$$$)
For each day, output a line consisting of the word "Ivan" if Ivan will be well-fed that day, and "Isabel" otherwise.
6 5 1 1 3 2 4 6 5 8 5 6 9 6 1 2 1 3 2 4 4 5 1 6
Ivan Isabel Ivan Ivan Isabel
3 6 56 78 65 983 834 721 1 1 1 2 1 3 2 2 2 3 3 3
Isabel Isabel Ivan Isabel Ivan Ivan
| Название |
|---|


