1 条题解

  • 1
    @ 2025-5-7 20:46:10
    #include <bits/stdc++.h>
    using namespace std;
    void solve()
    {
        int n;
        cin >> n;
        vector<int> a(n);
        for(auto & x : a) cin >> x;
        int maxx = *max_element(a.begin(), a.end());
        int minn = *min_element(a.begin(), a.end());
        if(maxx == minn)
        {
            cout << "No" << '\n';
            return;
        }
        cout << "Yes" << '\n';
        for(auto x : a)
        {
            if(x == maxx) cout << 1 << ' ';
            else cout << 2 << ' ';
        }
        cout << '\n';
    }
    
    signed main()
    {
        int t = 1;
        cin >> t;
        while (t --) solve();
        return 0;
    }
    
    • 1

    信息

    ID
    5565
    时间
    1000ms
    内存
    256MiB
    难度
    10
    标签
    (无)
    递交数
    1
    已通过
    1
    上传者