当前位置:网站首页>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 1550. There are three consecutive arrays of odd numbers
- 字节跳动新程序员成长秘诀:那些闪闪发光的宝藏mentor们
- Anaconda下安装Jupyter notebook
- 第5章 消费者组详解
- LeetCode 1638. Count the number of substrings with only one character difference
- Gridhome, a static site generator that novices must know
- SF smart logistics Campus Technology Challenge (no T4)
- 力扣leetcode第 280 场周赛
- sublime text 代码格式化操作
- ByteDance new programmer's growth secret: those glittering treasures mentors
猜你喜欢
Codeforces Round #799 (Div. 4)A~H
One hundred questions of image processing (1-10)
Ffmpeg command line use
QT realizes window topping, topping state switching, and multi window topping priority relationship
The concept of spark independent cluster worker and executor
Spark独立集群动态上线下线Worker节点
LeetCode 1560. The sector with the most passes on the circular track
Li Kou - 298th weekly match
使用jq实现全选 反选 和全不选-冯浩的博客
Hbuilder x format shortcut key settings
随机推荐
图像处理一百题(11-20)
Advancedinstaller installation package custom action open file
QT simulates mouse events and realizes clicking, double clicking, moving and dragging
(lightoj - 1349) Aladdin and the optimal invitation (greed)
力扣leetcode第 280 场周赛
Solve the problem that intel12 generation core CPU single thread only runs on small cores
Market trend report, technological innovation and market forecast of desktop electric tools in China
LeetCode 1584. Minimum cost of connecting all points
Hbuilder x format shortcut key settings
Kubernetes cluster deployment
Hbuilder X格式化快捷键设置
LeetCode 1566. Repeat the pattern with length m at least k times
Detailed explanation of FLV format
Codeforces - 1526C1&&C2 - Potions
One hundred questions of image processing (1-10)
(POJ - 3186) treatments for the cows (interval DP)
Educational Codeforces Round 122 (Rated for Div. 2)
Two weeks' experience of intermediate software designer in the crash soft exam
China tetrabutyl urea (TBU) market trend report, technical dynamic innovation and market forecast
Solve the problem of intel12 generation core CPU [small core full, large core onlookers] (win11)