1025 PAT Ranking (25)(25 分)

#include
#include
#include
using namespace std;
const int maxn = 3e4 + 10;
struct node {
    string rn;
    int fr, ln, lr;
    int score;
    bool operator<(const node&x)const
    {
        return score == x.score ? rnx.score;
    }
}a[maxn];

int n, cnt;
int main()
{
    scanf("%d", &n);
    for (int i = 0; i < n; i++)
    {
        int k;
        scanf("%d", &k);
        for (int j = 0; j < k; j++)
        {
            cin >> a[cnt].rn >> a[cnt].score;
            a[cnt].ln = i + 1;
            cnt++;
        }
        sort(a+cnt - k, a+cnt);
        a[cnt - k].lr = 1;
        for (int j = cnt - k+1; j < cnt; j++)
        {
            if (a[j].score == a[j - 1].score)a[j].lr = a[j - 1].lr;
            else a[j].lr = (j - (cnt - k)) + 1;
        }
    }
    sort(a, a + cnt);
    a[0].fr = 1;
    for (int i = 1; i < cnt; i++)
    {
        if (a[i].score == a[i - 1].score)a[i].fr = a[i - 1].fr;
        else a[i].fr = i + 1;
    }
    printf("%d\n", cnt);
    for (int i = 0; i 

你可能感兴趣的:(1025 PAT Ranking (25)(25 分))