当前位置:网站首页>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;
}
边栏推荐
- Spark独立集群动态上线下线Worker节点
- 字节跳动技术新人培训全记录:校招萌新成长指南
- Tree of life (tree DP)
- 图像处理一百题(1-10)
- LeetCode 1561. The maximum number of coins you can get
- Ffmpeg command line use
- LeetCode 1560. The sector with the most passes on the circular track
- Codeforces Round #799 (Div. 4)A~H
- Click QT button to switch qlineedit focus (including code)
- 视频压缩编码和音频压缩编码基本原理
猜你喜欢
随机推荐
提交Spark应用的若干问题记录(sparklauncher with cluster deploy mode)
SQL quick start
Advancedinstaller installation package custom action open file
第三章 MapReduce框架原理
Solve the single thread scheduling problem of intel12 generation core CPU (II)
Codeforces Round #802(Div. 2)A~D
视频压缩编码和音频压缩编码基本原理
Chapter 5 detailed explanation of consumer groups
字节跳动新程序员成长秘诀:那些闪闪发光的宝藏mentor们
Chapter 5 namenode and secondarynamenode
LeetCode 1584. Minimum cost of connecting all points
Story of [Kun Jintong]: talk about Chinese character coding and common character sets
JS encapsulates the method of array inversion -- Feng Hao's blog
LeetCode 1638. Count the number of substrings with only one character difference
VMware Tools和open-vm-tools的安装与使用:解决虚拟机不全屏和无法传输文件的问题
China tetrabutyl urea (TBU) market trend report, technical dynamic innovation and market forecast
原生js实现全选和反选的功能 --冯浩的博客
Educational Codeforces Round 122 (Rated for Div. 2)
Research Report on market supply and demand and strategy of China's tetraacetylethylenediamine (TAED) industry
LeetCode 1566. Repeat the pattern with length m at least k times









