This page is still under construction.

Parts of this page are still being built. What you see may change.

Sudden Attack 3

Interview

Time limit2sMemory limit1024 MB

Summary
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 NN players, including Junwon. Junwon's attack power is A1A_1, and the attack powers of the others are A2,⋯ ,ANA_2, \cdots, A_N.

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 XX attacks player B with attack power YY,

  • If X>YX > Y, B dies and A's attack power becomes X+YX+Y.
  • If X<YX < Y, A dies and B's attack power becomes X+YX+Y.
  • If X=YX = Y, nothing happens.

The battle has finally begun! Can Junwon become the last survivor?

Input

The first line gives the number of players NN, including Junwon.

The second line gives each player's attack power A1,⋯ ,ANA_1, \cdots, A_N 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

  • 1≤N≤100 0001 \le N \le 100\,000
  • 1≤Ai≤1 000 000 0001 \le A_i \le 1\,000\,000\,000 (1≤i≤N1 \le i \le N)

Examples2

  1. Example 1

    Input
    5
    2 1 2 3 4
    
    Expected output
    Yes
    
  2. Example 2

    Input
    5
    2 1 1 1 10
    
    Expected output
    No