Vanya and Jackets | 프로그래밍의 벗 PivotOJ
PivotOJ

Vanya and Jackets

시간 제한: 2000ms메모리 제한: 1024MB출처: MOOI 2016-17 finalBOJ 30758

문제

Vanya attempted to change his life once again and decided to create a schedule of jackets he is going to wear during the next nn days.

He read several manuals on jackets operation and found out that different jackets are designed for different temperature ranges. For each of his mm jackets he determined values of lil_i and rir_i, the minimum and maximum temperature value that admits wearing the ii-th jacket.

Vanya knows the weather forecast for the next nn days, namely there will be the temperature of aja_j during the jj-th day. Since Vanya is sane enough, he will choose the appropriate jacket for each temperature, that is, on the jj-th day he will wear any jacket ii such that liajril_i \leq a_j \leq r_i. Also, Vanya tries to be really fashionable, so he never wears the same jacket for two consecutive days.

Given the fact that Vanya's mother does not allow him leaving home without the jacket or wearing several jackets, create a schedule of which jackets he should wear during the next nn days satisfying all the requirements of Vanya.

입력

The first line of the input contains two integers nn and mm (1n,m1000001 \leq n, m \leq 100\,000), the number of days and the number of jackets in Vanya's wardrobe respectively.

The second line of the input contains nn integers aia_i (0ai1090 \leq a_i \leq 10^9), the temperature at the ii-th day.

Then mm lines follow, ii-th of them contains two integers lil_i and rir_i (0liri1090 \leq l_i \leq r_i \leq 10^9), defining the temperature range of the ii-th jacket.

출력

If there exists a way of choosing a jacket for each of the nn days, output the word "Yes" (without the quotes) in the first line, and nn numbers bib_i in the second line, where bib_i is the index of a jacket Vanya should wear in the ii-th day. Otherwise output the only line containing the word "No" (without the quotes). Jackets are indexed starting from one in the order they appear in the input.

If there are several satisfying schedules, you are allowed to output any of them.

힌트

In the first sample the answer "2 1 2 4" is not the only possible, another correct answer is "1 2 1 4".

In the second sample there is no schedule satisfying the requirements of Vanya, since he is obligated to wear the first jackets for both the first and the second days.

예제

예제 1

입력
4 4
25 25 30 50
10 40
20 30
70 100
50 50
출력
Yes
2 1 2 4

예제 2

입력
4 2
30 40 50 60
30 40
50 60
출력
No
코드를 제출하려면 로그인하세요.