题目:
附代码:
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<cmath>
#include<climits>
#include<vector>
#include<stack>
#include<queue>
#define MAXA 100000
using namespace std;
int n,c[MAXA],cc[MAXA],maxd,mark[MAXA],maxj;
struct rx
{
int len,N;
vector<int> g;
}gene[MAXA];
bool cmp(rx x,rx y)
{
if(x.g.size() != y.g.size())
return x.g.size() < y.g.size();
else return x.g > y.g ;
}
int main()
{
//freopen("gene.in","r",stdin);
//freopen("gene.out","w",stdout);
scanf("%d",&n);
for(int i=0;i<n;i++)
{
scanf("%d",&gene[leni].);//输入
gene[i].N = i;
for(int j=0;j<gene[i].len;j++)
{
int num;
scanf("%d",&num);
gene[i].g.push_back(num);
}
}
stable_sort(gene,gene+n,cmp);//又看见一个高端的函数,保证相等元素原本的相对次序在排序后保持不变
for(int i=0;i<n;i++)
{
if(i == n-1)
{
printf("%d",gene[i].N + 1);
return 0;
}
printf("%d ",gene[i].N + 1);
}
}