1015

失败了

#include
#include
#include
#include

using namespace std;

class Stu_grades
{
public:
    Stu_grades() = default;
    Stu_grades(istream &in) { in >> id >> de >> ci; }
    unsigned get_de() { return de; }
    unsigned get_ci() { return ci; }
    unsigned get_total() { return (de + ci); }
    string get_id() { return id; }
private:
    string id;
    unsigned de = 0;
    unsigned ci = 0;
};



int main()
{
    unsigned n = 0;
    unsigned l = 60;
    unsigned h = 99;
    cin >> n >> l >> h;

    vector students;
    for (unsigned i = 0; i < n; ++i)
    {
        Stu_grades tmp(cin);
        if (tmp.get_ci() >= l && tmp.get_de() >= l)
            students.push_back(tmp);
    }

    vector one;
    vector two;
    vector three;
    vector four;

    for (auto &r : students)
    {
        if (r.get_de() >= h && r.get_ci() >= h)
        {
            one.push_back(r);
        }
        if (r.get_de() >= h && r.get_ci() < h)
        {
            two.push_back(r);
        }
        if (r.get_de() < h &&r.get_ci() < h && r.get_ci() <= r.get_de())
        {
            three.push_back(r);
        }
        if (r.get_de() < h &&r.get_ci() < h && r.get_ci() > r.get_de())
        {
            four.push_back(r);
        }
    }

    vector> out_stu;
    out_stu.push_back(one);
    out_stu.push_back(two);
    out_stu.push_back(three);
    out_stu.push_back(four);

    for (auto r1 = out_stu.begin(); r1 != out_stu.end(); ++r1)
    {
        sort((*r1).begin(), (*r1).end(), [](Stu_grades &a, Stu_grades &b) {return a.get_total() > b.get_total(); });
        stable_sort((*r1).begin(), (*r1).end(), [](Stu_grades &a, Stu_grades &b) {return a.get_de() > b.get_de(); });
        stable_sort((*r1).begin(), (*r1).end(), [](Stu_grades &a, Stu_grades &b) {return a.get_id() < b.get_id(); });
    }


    //cout << students.size() << endl;;
    /*for (auto r1 : out_stu)
    {
        for (auto r2 : r1)
        {
            cout << r2.get_id() << " " << r2.get_de() << " " << r2.get_ci() << endl;
        }
    }*/

    system("pause");
    return 0;
}

你可能感兴趣的:(1015)