hiho week 285 register

Ended

Participants:42

Verdict:Accepted
Score:100 / 100
Submitted:2019-12-17 17:44:55

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
#include<bits/stdc++.h>
using namespace std;
template<class T>
inline void read(T &x)
{
    char c;x=1;
    while((c=getchar())<'0'||c>'9') if(c=='-') x=-1;
    T res=c-'0';
    while((c=getchar())>='0'&&c<='9') res=res*10+c-'0';
    x*=res;
}
int T,N,R,ans;
int heap[2510],h;
struct node{
    int A,P;
}coins[5010];
bool cmpNode(node x,node y){return x.A<y.A;}
void maintain(){
    int i=0,j,k,l=1;
    while(i<l){
        i=l;
        j=i*2;
        k=j+1;
        if(j<=h && heap[j]<heap[l])l=j;
        if(k<=h && heap[k]<heap[l])l=k;
        if(i<l)swap(heap[i],heap[l]);
    }
}
void push(int x){
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX