Sudden Attack 3
InterviewTime limit2sMemory limit1024 MB
Given attack powers where a winner absorbs the loser's power, decide whether player 1 can be the last survivor under some order of fights.
- Level
Medium6 of 10
- Topics
- Greedy, Sorting, Implementation, Math
- Solved
- No attempts yet
Problem
Since last summer, when we started preparing for G-Star, through CBT and launch preparation, up to today. On weekday evenings I have almost never seen my family awake.
Now, two days before the official launch. The sound of wind and bleak rain beats against the office window.
The calm before the storm.
To those who mocked Sudden Attack 3 on Blind, and still mock it, I did not write a rebuttal.
Whether you are the incompetent ones or we are, the results will tell.
Junwon, a game developer at Nexon, is testing Sudden Attack 3 ahead of its release.
The map has players, including Junwon. Junwon's attack power is , and the attack powers of the others are .
Once the battle begins, anyone can attack anyone! A dead player can neither attack nor be attacked, and two players never attack at the same time.
When player A with attack power attacks player B with attack power ,
- If , B dies and A's attack power becomes .
- If , A dies and B's attack power becomes .
- If , nothing happens.
The battle has finally begun! Can Junwon become the last survivor?
Input
The first line gives the number of players , including Junwon.
The second line gives each player's attack power in order, separated by spaces.
Output
Print Yes if there exists a good battle order that leaves Junwon as the only survivor and kills all the other players. Otherwise, if Junwon can never be the last survivor no matter what order the battle takes, print No.
Constraints
- ()