- 题意
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/c13cb57d3a97db359f77fcc2a741b820.png)
- 思路
STL永远的神。。。
#include<bits/stdc++.h>
using namespace std;
const int N=1e3+10;
char liu[N][N];
int cnt[N];
#define PII pair<vector<int>,int>
#define x first
#define y second
vector<PII> vec;
bool cmp(PII a,PII b)
{
if(a.y!=b.y){
return a.y>b.y;
}
else{
return a.x<b.x;
}
}
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
int n,m;
cin>>n>>m;
map<vector<int>,int> mp;
for(int i=1;i<=n;i++){
vector<int> temp;
for(int j=1;j<=m;j++){
int x;
cin>>x;
temp.push_back(x);
}
mp[temp]++;
}
for(auto &item:mp){
vec.push_back({item.first,item.second});
}
sort(vec.begin(),vec.end(),cmp);
cout<<vec.size()<<endl;
for(auto &item:vec){
cout<<item.second<<" ";
int len=item.first.size();
for(int i=0;i<item.first.size()-1;i++){
cout<<item.first[i]<<" ";
}
cout<<item.first[len-1]<<endl;
}
return 0;
}