Олимпиадный тренинг

Задача 29472. Keyboard


Задача

Темы:
Everyone knows that over time, the keyboard wears out, and the keys on it begin to stick. Of course, you can still use such a keyboard for some time, but you have to use more force to press the keys.
 
In the manufacture of the keyboard, initially for each key, the number of presses that it must withstand is set. If you know these values ​​for the keyboard you are using, then for a certain sequence of keys pressed, you can determine which keys will break during their use, and which – no.
 
You need to write a program that determines which keys will break during a given use of the keyboard.
 
Input
The first line of the input file contains the integer n (1 ≤ n ≤ 100) – the number of keys on the keyboard. The second line contains n integers – c1, c2, … , сn, where сi (1 ≤ сi ≤ 100000) – the number of times the i-th key can be pressed. The third line contains the integer k (1 ≤ k ≤ 100000) – the total number of keystrokes, and the last line contains k integers pj (1 ≤ pj ≤ n) – keystroke sequence.
 
Output
In the output file, output n lines containing information about the health of the keys. If the i-th key is broken, then the i-th line should contain the word “yes” (without quotes), if the key is functional – the word “no”.
 
 
Input Output
5
1 50 3 4 3
16
1 2 3 4 5 1 3 3 4 5 5 5 5 5 4 5
yes
no
no
no
yes

Individual Olympiads, All-Russian Olympiad for schoolchildren, Regional stage, 2009, 2nd day, Problem A

Запрещенные операторы:sort