#include<iostream>
#include<queue>
using namespace std;
struct node
{
int num;
friend bool operator<(node n1,node n2)
{
return n1.num>n2.num;
}
};
int main()
{
node now,next;
priority_queue<node>q;
char c;
int n,k;
cin>>n>>k;
int m=0;
while(n--)
{
cin>>c;
if(c=='I')
{
cin>>next.num;
if(m<k)
{
q.push(next);
m++;
}
else
{
now=q.top();
if(next.num>now.num)
{
q.pop();
q.push(next);
}
}
}
else
{
now=q.top();
cout<<now.num;
}
}
return 0;
}
hdu 4006 The kth great number
最新推荐文章于 2019-09-21 18:19:12 发布