1 solutions
-
0
#include <bits/stdc++.h> using namespace std; struct Node{ vector<int> v; friend bool operator< (Node a,Node b){ if(a.v.front() == b.v.front()){ return a.v.size() > b.v.size(); } return a.v.front() > b.v.front(); } }; priority_queue<Node> q; int main(){ int n,c,num; cin>>n; Node m[n]; for(int i = 0 ; i < n ; i++){ cin>>c; for(int j = 0 ; j < c ; j++){ cin>>num; m[i].v.push_back(num); } sort(m[i].v.begin(),m[i].v.begin()+c); q.push(m[i]); } for(int i = 0 ; i < n ; i++){ Node tmp = q.top(); for(vector<int>::iterator j = tmp.v.begin() ; j != tmp.v.end() ; j++){ cout<<*j<<" "; } cout<<endl; q.pop(); } return 0; }
Information
- ID
- 840
- Time
- 1000ms
- Memory
- 128MiB
- Difficulty
- 3
- Tags
- # Submissions
- 26
- Accepted
- 18
- Uploaded By