CF1718D Permutation for Burenka
Description
Recently, Tonya found out that Burenka really likes a permutation $ p $ of length $ n $ . Tonya decided to please her and give her an array $ a $ similar to $ p $ . He already fixed some elements of $ a $ , but exactly $ k $ elements are missing (in these positions temporarily $ a\_i = 0 $ ). It is guaranteed that $ k \\ge 2 $ . Also, he has a set $ S $ of $ k - 1 $ numbers.
Tonya realized that he was missing one number to fill the empty places of $ a $ , so he decided to buy it. He has $ q $ options to buy. Tonya thinks that the number $ d $ suits him, if it is possible to replace all zeros in $ a $ with numbers from $ S $ and the number $ d $ , so that $ a $ becomes a pure array similar to $ p $ . For each option of $ d$$$, output whether this number is suitable for him or not.