hiho week 136 register

Ended

Participants:181

Verdict:Accepted
Score:100 / 100
Submitted:2017-02-07 06:24:57

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
//
//  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){
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX