Codeforces Round 176 (Div. 2)
E
Main Sequence
Codeforces
未评级
原题
← D→
翻译中…

As you know, Vova has recently become a new shaman in the city of Ultima Thule. So, he has received the shaman knowledge about the correct bracket sequences. The shamans of Ultima Thule have been using lots of different types of brackets since prehistoric times. A bracket type is a positive integer. The shamans define a correct bracket sequence as follows:

翻译中…
  • An empty sequence is a correct bracket sequence.
  • If ${*a*_{1}, *a*_{2}, ..., *a*_{*l*}}$ and ${*b*_{1}, *b*_{2}, ..., *b*_{*k*}}$ are correct bracket sequences, then sequence ${*a*_{1}, *a*_{2}, ..., *a*_{*l*}, *b*_{1}, *b*_{2}, ..., *b*_{*k*}}$ (their concatenation) also is a correct bracket sequence.
  • If ${*a*_{1}, *a*_{2}, ..., *a*_{*l*}}$ — is a correct bracket sequence, then sequence image also is a correct bracket sequence, where $*v*$ $(*v* > 0)$ is an integer.
翻译中…

For example, sequences ${1, 1,  - 1, 2,  - 2,  - 1}$ and ${3,  - 3}$ are correct bracket sequences, and ${2,  - 3}$ is not.

翻译中…

Moreover, after Vova became a shaman, he learned the most important correct bracket sequence ${*x*_{1}, *x*_{2}, ..., *x*_{*n*}}$, consisting of $*n*$ integers. As sequence $*x*$ is the most important, Vova decided to encrypt it just in case.

翻译中…

Encrypting consists of two sequences. The first sequence ${*p*_{1}, *p*_{2}, ..., *p*_{*n*}}$ contains types of brackets, that is, $*p*_{*i*} = |*x*_{*i*}|$ ($1 ≤ *i* ≤ *n*$). The second sequence ${*q*_{1}, *q*_{2}, ..., *q*_{*t*}}$ contains $*t*$ integers — some positions (possibly, not all of them), which had negative numbers in sequence ${*x*_{1}, *x*_{2}, ..., *x*_{*n*}}$.

翻译中…

Unfortunately, Vova forgot the main sequence. But he was lucky enough to keep the encryption: sequences ${*p*_{1}, *p*_{2}, ..., *p*_{*n*}}$ and ${*q*_{1}, *q*_{2}, ..., *q*_{*t*}}$. Help Vova restore sequence $*x*$ by the encryption. If there are multiple sequences that correspond to the encryption, restore any of them. If there are no such sequences, you should tell so.

翻译中…

Input

翻译中…

The first line of the input contains integer $*n*$ ($1 ≤ *n* ≤ 10^{6}$). The second line contains $*n*$ integers: $*p*_{1}, *p*_{2}, ..., *p*_{*n*}$ $(1 ≤ *p*_{*i*} ≤ 10^{9})$.

翻译中…

The third line contains integer $*t*$ ($0 ≤ *t* ≤ *n*$), followed by $*t*$ distinct integers $*q*_{1}, *q*_{2}, ..., *q*_{*t*}$ $(1 ≤ *q*_{*i*} ≤ *n*)$.

翻译中…

The numbers in each line are separated by spaces.

翻译中…

Output

翻译中…

Print a single string "NO" (without the quotes) if Vova is mistaken and a suitable sequence ${*x*_{1}, *x*_{2}, ..., *x*_{*n*}}$ doesn't exist.

翻译中…

Otherwise, in the first line print "YES" (without the quotes) and in the second line print $*n*$ integers $*x*_{1}, *x*_{2}, ..., *x*_{*n*}$ $(|*x*_{*i*}| = *p*_{*i*}; *x*_{*q*_{*j*}} < 0)$. If there are multiple sequences that correspond to the encrypting, you are allowed to print any of them.

翻译中…

样例

Input #1
2
1 1
0
Output #1
YES
1 -1
InputCopy OutputCopy
Input #2
4
1 1 1 1
1 3
Output #2
YES
1 1 -1 -1
InputCopy OutputCopy
Input #3
3
1 1 1
0
Output #3
NO
InputCopy OutputCopy
Input #4
4
1 2 2 1
2 3 4
Output #4
YES
1 2 -2 -1
InputCopy OutputCopy
题目信息
题号
287E
时间限制
2 s
内存限制
256 MB

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。