sort cmp new
đã đăng vào 10, Tháng 10, 2024, 9:32include<bits></bits>
define ll long long
using namespace std; ll n, s; string a[1000006]; bool cmp(const pair<ll ll> &a, const pair<ll ll> &b){ if(a.second==b.second) return a.first < b.first; return a.second < b.second; } int main(){ iosbase::syncwithstdio(0); cin.tie(0); cout.tie(0); cin>>n; vector<ll>v(n); for(ll i=0; i<n i>>v[i]; unordered</n></ll>map<ll ll>dem; for(ll i=0; i<n i vector>> tanso(dem.begin(), dem.end()); sort(tanso.begin(), tanso.end(), cmp); for(const auto& it : tanso) for(ll i=0; i<it.second i output:></it.second> //---------------------------------------------------------- //8 | 9 3 3 5 5 2 2 2 //5 9 5 3 2 2 3 2 |</n></ll></ll></ll>