P1177 【模板】快速排序 multiset解法

P1177 【模板】快速排序

由于multiset能自动对关键值进行排序,所以multiset可以进行排序功能且支持相同关键值

#include<bits/stdc++.h>
using namespace std;
int main()
{
     multiset<int> s;
     int n;
    cin>>n;
    for (int i=1;i<=n;i++)
    {
          int x;
          cin>>x;
          s.insert(x);
    }
    multiset<int>::iterator it;
    for (it=s.begin();it!=s.end();it++)
   {
        cout<<*it<<" ";
   }
}

posted @ 2022-03-02 08:45  心悟&&星际  阅读(38)  评论(0编辑  收藏  举报