Codeforces Round #572 (Div. 2) B Number Circle

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

ll a[100001];
ll b[100001];

int main()
{    
    int n, i;
    cin>>n;
    for(i=0; i<n; i++) 
    cin>>a[i];
    sort(a, a+n);
    if(a[n-1] < a[n-2]+a[n-3])
    {
        cout<<"YES\n";
        swap(a[n-1], a[n-2]);
        for(i=0;i<n;i++)
        cout<<a[i]<<" ";
    }
 
    else cout<<"NO\n";
    
    
    //system("pause");

}
    
    

 

posted @ 2020-09-25 18:50  Wh1te  阅读(109)  评论(0编辑  收藏  举报