1015 德才论(25 分)

#include
#include
#include
#include
using namespace std;
const int maxn = 1e5 + 10;
struct stu {
    int id, dscore, cscore, tot;
    bool operator<(const stu&x)const
    {
        return tot == x.tot ? dscore == x.dscore ? id x.dscore : tot > x.tot;
    }
}temp;
int n, L, H;
vectorans[5];
int main()
{
    scanf("%d%d%d", &n, &L, &H);
    while (n--)
    {
        scanf("%d%d%d", &temp.id, &temp.dscore, &temp.cscore);
        temp.tot = temp.dscore + temp.cscore;
        if (temp.dscore < L || temp.cscore < L)continue;
        if (temp.dscore >= H&&temp.cscore >= H)ans[0].push_back(temp);
        else if (temp.dscore >= H&&temp.cscore >= L)ans[1].push_back(temp);
        else if (temp.dscore < H&&temp.cscore < H&&temp.dscore >= temp.cscore)ans[2].push_back(temp);
        else ans[3].push_back(temp);
    }
    int cnt = 0;
    for (int i = 0; i < 4; i++)cnt += ans[i].size();
    printf("%d\n", cnt);
    for (int i = 0; i < 4; i++)
    {
        sort(ans[i].begin(), ans[i].end());
        for (int j = 0; j < ans[i].size(); j++)printf("%08d %d %d\n", ans[i][j].id, ans[i][j].dscore, ans[i][j].cscore);
    }
    return 0;
}

你可能感兴趣的:(1015 德才论(25 分))