ГлавнаяСборникиТурнирыРазделыФорумыУчастникиПечатьПомощьО системе

Разделы > Неотсортированные > задача:


Butterfly

Задачи раздела

• Triangle
• Brackets
• Bookshelf
• Coin Game
• Butterfly
• Word power
• Best Grass
• Cow PinBall
• Cow Sorting
• Maximum Sum
• Making Change
• Colored hills
• Word Statistics

Обратная связь

Если у вас есть предложения или пожелания по работе Contester, посетите форум сайта www.contester.ru.

Лимит времени 1500/1500/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб.

Problem description

Bob is collecting butterflies. He has a great collection of them from all over the world. Each type of butterfly has it's own identifier and there are 20000000 of different types in the world. Whenever he finds a butterfly he has to look up collection and find out if this type already exist in there. He has exactly N (1 <= N <= 100000) types of butterflies in his collection. One day he was very lucky and found M (1 <= M <= 100000) butterflies. Help him to find out which of them are already in his collection and which aren't.

Input

On the first line of input there is one integer N. On the second line there are N integers - idetifiers of types of butterflies he has. On the third line there is one integer M. On the forth line there are M integers - idetifiers of types of butterflies he found.

Output

For every butterfly he found write on different lines of output 1 - if it already exist, 0 - if not.

Example

stdin stdout

5
2 3 4 7 9
3
1 3 1000000

0
1
0

Для отправки решений необходимо выполнить вход.

www.contester.ru