当前位置:网站首页>7-12 inventory code base
7-12 inventory code base
2022-07-06 16:44:00 【HBUcs2020】
Have to say , The code of others is really good
c++ Containers set Custom sort _zhusf The blog of -CSDN Blog _c++set Sort
#include <bits/stdc++.h>
using namespace std;
const int N = 1e4+10;
struct cmp// Customize set Sort
{
bool operator() (const pair<int,vector<int> >&a, const pair<int,vector<int> >&b) const
{
if(a.first!=b.first)
return a.first>b.first;
else return a.second<b.second;
}
};
set<vector<int> > st;// Save module
map<vector<int>,int> mp;// Number of stored modules
set<pair<int,vector<int> >,cmp > St;// Sort
int main()
{
int n,m;
cin>>n>>m;
for(int i=0; i<n; i++)
{
vector<int> vt;
for(int j=0; j<m; j++)
{
int x;
cin>>x;
vt.push_back(x);
}
mp[vt]++;
st.insert(vt);
}
cout<<st.size()<<endl;
set<vector<int> >::iterator it;
for(it=st.begin(); it!=st.end(); it++)
{
St.insert({mp[*it],*it});
}
set<pair<int,vector<int> > >::iterator ite;
for(ite=St.begin(); ite!=St.end(); ite++)
{
cout<<(*ite).first;
for(int i=0; i<(*ite).second.size(); i++)
cout<<' '<<(*ite).second[i];
cout<<endl;
}
return 0;
}
边栏推荐
- LeetCode 1560. The sector with the most passes on the circular track
- LeetCode 1020. Number of enclaves
- LeetCode 1984. Minimum difference in student scores
- Cmake error: could not create named generator visual studio 16 2019 solution
- LeetCode 1447. Simplest fraction
- LeetCode 1641. Count the number of Lexicographic vowel strings
- Spark独立集群动态上线下线Worker节点
- Spark's RDD (elastic distributed data set) returns a large result set
- Double specific tyrosine phosphorylation regulated kinase 1A Industry Research Report - market status analysis and development prospect prediction
- China double brightening film (dbef) market trend report, technical dynamic innovation and market forecast
猜你喜欢
Solve the problem of intel12 generation core CPU [small core full, large core onlookers] (win11)
sublime text 代码格式化操作
Simple records of business system migration from Oracle to opengauss database
SF smart logistics Campus Technology Challenge (no T4)
Li Kou - 298th weekly match
第6章 DataNode
Basic principles of video compression coding and audio compression coding
Remove the border when input is focused
图像处理一百题(1-10)
第5章 NameNode和SecondaryNameNode
随机推荐
Market trend report, technical innovation and market forecast of double-sided foam tape in China
Codeforces Round #771 (Div. 2)
Codeforces Round #798 (Div. 2)A~D
Soft music -js find the number of times that character appears in the string - Feng Hao's blog
Solve the single thread scheduling problem of intel12 generation core CPU (II)
Hbuilder X格式化快捷键设置
Acwing: Game 58 of the week
Click QT button to switch qlineedit focus (including code)
Research Report on market supply and demand and strategy of China's four seasons tent industry
SQL快速入门
Chapter 5 namenode and secondarynamenode
LeetCode 1557. The minimum number of points that can reach all points
SF smart logistics Campus Technology Challenge (no T4)
FLV格式详解
Research Report on market supply and demand and strategy of China's tetraacetylethylenediamine (TAED) industry
业务系统兼容数据库Oracle/PostgreSQL(openGauss)/MySQL的琐事
Spark's RDD (elastic distributed data set) returns a large result set
Log statistics (double pointer)
MariaDB的安装与配置
300th weekly match - leetcode