#include<iostream>
#include<algorithm>
#include<string>
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 ? rn<x.rn : score>x.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 <cnt; i++)
{
cout << a[i].rn << " " << a[i].fr << " " << a[i].ln << " " << a[i].lr << endl;
}
return 0;
}
1025 PAT Ranking (25)(25 分)
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。
相關(guān)閱讀更多精彩內(nèi)容
- 都說農(nóng)村的老大,不如城里的孩子。沒有見識的人都會被扣上一個鄉(xiāng)巴佬的帽子。農(nóng)村人到城里一概不知。所以被城里人稱為鄉(xiāng)巴...