Logo
(追記) (追記ここまで)

19842번 - Restoring the Sequence 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 512 MB236988441.584%

문제

It's school time, and today the first graders are learning about positive integers. The teacher wrote numbers from 1ドル$ to $n$ in ascending order on the blackboard, for demonstration.

Unfortunately, young hooligan Kolya from the 11-th grade ran into the classroom and ruined the beautiful sequence written on the blackboard. Standing before the principal he repented and claimed that he only erased one number from the sequence.

Help the teacher to figure out whether this can be true, and if it can, which number was erased by Kolya.

입력

The first line of input contains one integer $n$ --- the number of integers written by the teacher on the blackboard (2ドル \le n \le 1000$).

The second line of input contains the number $m$ --- the number of integers on the blackboard after Kolya's actions (1ドル \le m \le 1000$).

The third line contains $m$ integers $a_1, a_2, \ldots, a_m$ --- the integers on the blackboard after Kolya's actions, in the order they are written on the board (1ドル \le a_i \le 1000$).

출력

If Kolya's explanations are plausible, and the numbers written on the blackboard could be obtained from the sequence 1,ドル 2, \ldots, n$ by erasing exactly one number, output the word <<Yes>> at the first line. The next line must contain the number that was erased by Kolya.

Otherwise output one word <<No>>.

제한

예제 입력 1

4
3
1 3 4

예제 출력 1

Yes
2

예제 입력 2

4
3
3 3 3

예제 출력 2

No

예제 입력 3

4
2
1 2

예제 출력 3

No

예제 입력 4

4
4
1 2 3 4

예제 출력 4

No

예제 입력 5

4
3
4 3 1

예제 출력 5

No

힌트

출처

Olympiad > Russian Olympiad in Informatics > Russia Team High School Programming Contest > Russia Team High School Programming Contest 2017 M번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /