HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Sections > Unsorted > problem:


Butterfly

Section problems

• Coin Game
• Cow PinBall
• Cow Sorting
• Colored hills
• Word power
• Word Statistics
• Brackets
• Triangle
• Butterfly
• Galls village
• Sequence
• Bishops
• Polygons
• String manipulations
• Lawyers Council
• Math and Soldiers
• Many-coloured roads

Feedback

If you notice incorrect translations in Contester, please let author know.

Time limit 1500/1500/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb.

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