Lang:G++
Edit12345678910111213141516171819202122232425262728293031//// main.cpp// 优化延迟//// Created by lianyuzhe on 2017/2/7.// Copyright © 2017年 lianyuzhe. All rights reserved.//#include <iostream>#include <cstdio>#include <vector>using namespace std;vector <int>Array;int N;template <typename T,int (*cmp)(const T&x,const T&y)>class Heap{public:int N,n;T *heapArray;Heap(int i_n):N(i_n),n(0){heapArray=new T[N];}~Heap(){delete[]heapArray;}void clear(){n=0;}void insert(T t){heapArray[n++]=t;up(n-1);}void del(int pos){