您当前的位置: 首页 > 

*DDL_GzmBlog

暂无认证

  • 3浏览

    0关注

    605博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

[luogu] P1168中位数 vector||堆||树状数组

*DDL_GzmBlog 发布时间:2021-10-21 10:56:04 ,浏览量:3

文章目录
      • 前言
        • Vector
        • CODE
        • Heap
        • CODE

前言

传送门 : 题解千奇百怪

Vector

因为我们是需要输出 一个序列里面有序的中位数,显然我们不可能每次插入都进行一次排序 所以我们可以利用二分,索引下标之后再进行查找

CODE
#include 
using namespace std;
#define ll long long
#define endl '\n'
const int N  = 10;

void cal()
{

}
void solve()
{
    int n;cin>>n;
    vector a;
    for(int i=1;i>x;
        a.insert(upper_bound(a.begin(),a.end(),x),x);
        if(i%2 == 1){
            coutx;
    int mid = x;

    cout            
关注
打赏
1657615554
查看更多评论
0.0996s