#P3500. [POI2010] TES-Intelligence Test
[POI2010] TES-Intelligence Test
题目描述
One of the tasks in the Byteotian Intelligence Test (BIT) is to cross out numbers from an initial sequence in such a way that leaves as a result certain given sequences.
Byteasar longs to become the IQ Master of Byteotia, but he is no good in this kind of tasks.
But since practice makes perfect, he intends to practise a lot.
So much in fact that he asks you to write a program that will facilitate the training by verifying his answers quickly.
输入格式
The first line of the standard input contains one integer ().
The second line holds integers ( for ), separated by single spaces, that constitute the initial sequence of the test.
The third line of the input holds one integer .
The following lines describe the sequences to be obtained by crossing out numbers from the initial sequence.
Each sequence's description takes two successive lines.
The first of these two lines contains an integer ().
The second contains an -element long sequence of integers ( for )separated by single spaces. You may assume that the total length on given sequences does not exceed .
输出格式
Your program should print out lines to the standard output.
The -th line (for ) should hold one word, "TAK" (yes in Polish) if the -th input sequence can be obtained by crossing out (i.e., removing) some, not necessarily contiguous, numbers from the initial sequence, or "NIE" (no in Polish) otherwise. Mind you, only the words should be printed, no quotation marks. Of course, the order of the numbers left after crossing out is important, as can be seen in the example.
题目大意
题目描述
译自 POI 2010 Stage 1.「Intelligence Test」
给出一个母串 ,若干次询问,每次询问给出一个子串 ,请你求出这个子串是不是母串的子序列。
输入格式
第一行一个正整数 。
第二行 个空格隔开的正整数 ,表示母串。
第三行一个正整数 ,表示询问次数。
接下来 行,每两行表示一次询问,其中的第一行是一个正整数 ,第二行是 个空格隔开的正整数表示 ,表示询问的子串。
输出格式
输出共 行,每行一个字符串。
若第 次询问的串是母串的子序列,那么第 行应为 TAK
,否则应为 NIE
。
对于 的数据,有 ,且 ,这里 表示 组询问的 之和。
翻译来自于 LibreOJ。
7
1 5 4 5 7 8 6
4
5
1 5 5 8 6
3
2 2 2
3
5 7 8
4
1 5 7 4
TAK
NIE
TAK
NIE