栏目分类:
子分类:
返回
终身学习网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
终身学习网 > IT > 软件开发 > 后端开发 > C/C++/C#

C-Making the Grade (优先队列神仙优化)

C/C++/C# 更新时间:发布时间: 百科书网 趣学号
C-Making the Grade 优先队列的 O ( n l o g n ) O(nlogn) O(nlogn) 神仙解法(分析待补充,现在讲不灵清)

可以先看一下大佬的:ButterflyDew 的博客

#include 
using namespace std;

const int N=1e5+5;
int a[N];
priority_queue < int,vector,less > q;
signed main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int n;
    cin>>n;
    for(int i=1;i<=n;i++) cin>>a[i];
    int ans1=0,ans2=0;
    for(int i=1;i<=n;i++)
    {
        q.push(a[i]);
        if(a[i]=1;i--)
    {
        q.push(a[i]);
        if(a[i]
转载请注明:文章转载自 www.051e.com
本文地址:http://www.051e.com/it/296227.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 ©2023-2025 051e.com

ICP备案号:京ICP备12030808号