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

15287번 - Easy Quest 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
3 초 512 MB176907450.340%

문제

A young hero is starting his heroic life. The wise wizard suggested him an easy first quest. During this quest our young hero meets n magical creatures, in specific order. In order to help the young hero, the wizard gave him a clue — a list of n integers ai.

  • If ai is positive, then the i-th magical creature is benevolent and gives to our hero one magical item of type ai. The hero can keep several items of the same type.
  • If ai is negative, then the i-th magical creature is evil and in order to defeat it the young hero needs one magical item of type −ai. All magical items are fragile and can be used only once.
  • If ai is zero, then the i-th creature is a unicorn. It gives the hero any magical item he asks for, but only one.

Your task is to help the young hero to finish the first quest, defeating all enemies on the way, or say that it is impossible.

입력

The first line of input contains one integer n (1 ≤ n ≤ 1000). The second line contains n integers ai (−1000 ≤ ai ≤ 1000).

출력

If it is impossible to defeat all enemies, then output one string “No”. If it is possible, then output string “Yes”, and in the next line output the types of items the hero should ask the unicorns for, in order they meet during the quest. Types must be integers in range from 1 to 1000 inclusive. If there are several solutions, output any of them.

제한

예제 입력 1

10
1 0 -4 0 0 -1 -3 0 -1 -2

예제 출력 1

Yes
4 1 3 2

예제 입력 2

5
5 8 0 -6 -3

예제 출력 2

No

예제 입력 3

3
2 -2 -2

예제 출력 3

No

힌트

출처

ICPC > Regionals > Northern Eurasia > Northern Eurasia Finals > NEERC 2017 E번

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

출처

대학교 대회

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

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