Codeforces Round 310 (Div. 1)
B
Case of Fugitive
Codeforces
2000
原题
← AC →
翻译中…

Andrewid the Android is a galaxy-famous detective. He is now chasing a criminal hiding on the planet Oxa-5, the planet almost fully covered with water.

翻译中…

The only dry land there is an archipelago of $*n*$ narrow islands located in a row. For more comfort let's represent them as non-intersecting segments on a straight line: island $*i*$ has coordinates $[*l*_{*i*}, *r*_{*i*}]$, besides, $*r*_{*i*} < *l*_{*i* + 1}$ for $1 ≤ *i* ≤ *n* - 1$.

翻译中…

To reach the goal, Andrewid needs to place a bridge between each pair of adjacent islands. A bridge of length $*a*$ can be placed between the $*i*$-th and the $(*i* + 1)$-th islads, if there are such coordinates of $*x*$ and $*y*$, that $*l*_{*i*} ≤ *x* ≤ *r*_{*i*}$, $*l*_{*i* + 1} ≤ *y* ≤ *r*_{*i* + 1}$ and $*y* - *x* = *a*$.

翻译中…

The detective was supplied with $*m*$ bridges, each bridge can be used at most once. Help him determine whether the bridges he got are enough to connect each pair of adjacent islands.

翻译中…

Input

翻译中…

The first line contains integers $*n*$ ($2 ≤ *n* ≤ 2·10^{5}$) and $*m*$ ($1 ≤ *m* ≤ 2·10^{5}$) — the number of islands and bridges.

翻译中…

Next $*n*$ lines each contain two integers $*l*_{*i*}$ and $*r*_{*i*}$ ($1 ≤ *l*_{*i*} ≤ *r*_{*i*} ≤ 10^{18}$) — the coordinates of the island endpoints.

翻译中…

The last line contains $*m*$ integer numbers $*a*_{1}, *a*_{2}, ..., *a*_{*m*}$ ($1 ≤ *a*_{*i*} ≤ 10^{18}$) — the lengths of the bridges that Andrewid got.

翻译中…

Output

翻译中…

If it is impossible to place a bridge between each pair of adjacent islands in the required manner, print on a single line "No" (without the quotes), otherwise print in the first line "Yes" (without the quotes), and in the second line print $*n* - 1$ numbers $*b*_{1}, *b*_{2}, ..., *b*_{*n* - 1}$, which mean that between islands $*i*$ and $*i* + 1$ there must be used a bridge number $*b*_{*i*}$.

翻译中…

If there are multiple correct answers, print any of them. Note that in this problem it is necessary to print "Yes" and "No" in correct case.

翻译中…

Note

翻译中…

In the first sample test you can, for example, place the second bridge between points 3 and 8, place the third bridge between points 7 and 10 and place the first bridge between points 10 and 14.

翻译中…

In the second sample test the first bridge is too short and the second bridge is too long, so the solution doesn't exist.

翻译中…

样例

Input #1
4 4
1 4
7 8
9 10
12 14
4 5 3 8
Output #1
Yes
2 3 1
InputCopy OutputCopy
Input #2
2 2
11 14
17 18
2 9
Output #2
No
InputCopy OutputCopy
Input #3
2 1
1 1
1000000000000000000 1000000000000000000
999999999999999999
Output #3
Yes
1
InputCopy OutputCopy
题目信息
题号
555B
时间限制
3 s
内存限制
256 MB
标签
数据结构
贪心
排序

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