请问各位大佬这个算法的复杂度是多少?
查看原帖
请问各位大佬这个算法的复杂度是多少?
559506
BestFriend楼主2023/2/21 20:17

独树一帜的做法

请问各位大佬这个算法的复杂度是多少?谢谢

#include<queue>
#include<cstdio>
#include<vector>
int x;
std::priority_queue<int,std::vector<int>,std::greater<int>> heap;
signed main(){
    scanf("%d",&x);
    heap.push(x);
    scanf("%d",&x);
    heap.push(x);
    scanf("%d",&x);
    heap.push(x);
    printf("%d ",heap.top());
    heap.pop();
    printf("%d ",heap.top());
    heap.pop();
    printf("%d ",heap.top());
    heap.pop();
    return 0;
}
2023/2/21 20:17
加载中...