当前位置:网站首页>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;
}
边栏推荐
- (lightoj - 1370) Bi shoe and phi shoe (Euler function tabulation)
- Advancedinstaller installation package custom action open file
- (POJ - 3186) treatments for the cows (interval DP)
- 解决Intel12代酷睿CPU单线程调度问题(二)
- Tencent interview algorithm question
- Sublime text code formatting operation
- Educational Codeforces Round 122 (Rated for Div. 2)
- Market trend report, technological innovation and market forecast of China's double sided flexible printed circuit board (FPC)
- Acwing: Game 58 of the week
- 解决Intel12代酷睿CPU【小核载满,大核围观】的问题(WIN11)
猜你喜欢

Oneforall installation and use

Installation and configuration of MariaDB

Mp4 format details

Solve the single thread scheduling problem of intel12 generation core CPU (II)

< li> dot style list style type

提交Spark应用的若干问题记录(sparklauncher with cluster deploy mode)

Business system compatible database oracle/postgresql (opengauss) /mysql Trivia

300th weekly match - leetcode

第6章 Rebalance详解

SQL quick start
随机推荐
Simply try the new amp model of deepfacelab (deepfake)
第5章 消费者组详解
LeetCode 1552. Magnetic force between two balls
(lightoj - 1354) IP checking (Analog)
Codeforces Round #803 (Div. 2)A~C
LeetCode 1545. Find the k-th bit in the nth binary string
Codeforces Round #771 (Div. 2)
QT implementation fillet window
图像处理一百题(1-10)
Chapter 2 shell operation of hfds
Chapter III principles of MapReduce framework
LeetCode 1557. The minimum number of points that can reach all points
Raspberry pie 4b64 bit system installation miniconda (it took a few days to finally solve it)
Spark独立集群动态上线下线Worker节点
LeetCode 1551. Minimum operand to make all elements in the array equal
Li Kou leetcode 280 weekly match
Gridhome, a static site generator that novices must know
ByteDance new programmer's growth secret: those glittering treasures mentors
sublime text 代码格式化操作
Codeforces Global Round 19