##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
4 5 3 1 5 2 4 4 2 1 3 2 3 5 1 2 2 2 1
Sample 1: [3,1,5,2,4] Yes (S1={1,4}, S2={2,3,5}, ranges 3,3). Sample 2: [2,1,3,2] Yes (S1={1,2}, S2={2,3}, ranges 1,1). Sample 3: [5,1,2] No (no valid partition). Sample 4: [2,1] Yes (S1={2}, S2={1}, both single-element subsets have range 0).
Yes Yes No Yes
You are given an integer array of length . Determine whether it is possible to partition the elements into two non-empty subsets and (each element goes to exactly one subset) such that:
Note: A single-element subset has range (since ).
For each test case, output Yes if such a partition exists, otherwise output No.
Note: The judge is case-sensitive. Only exactly "Yes" or "No" will be accepted.
Where each answer is exactly "Yes" or "No" (case-sensitive).