#54877: c++解答


s410397@student.cysh.cy.edu.tw (Ron (SSRB))


#include <bits/stdc++.h>

using namespace std;

int main() {
    int t, x;
    cin >> t;

    vector < int > s;
    for (int i = 0; i < t; i++) {
        cin >> x;
        s.push_back(x);
    }
    int mx = * max_element(s.begin(), s.end());
    int mn = * min_element(s.begin(), s.end());
    int all = 0;
    for (int i = 0; i < t; i++) {
        all += mn + i;
    }
    int all2 = accumulate(s.begin(), s.end(), 0);
    if (all == all2) {
        cout << mn << " " << mx << " " << "yes";
    }
    else {
        cout << mn << " " << mx << " " << "no";
    }
}